Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DnsValidatedCertificate does not fail if certificate is both "pending validation" and "validation: success" #6081

Closed
nsvarich opened this issue Feb 3, 2020 · 5 comments · Fixed by #8552
Assignees
Labels
@aws-cdk/aws-certificatemanager Related to Amazon Certificate Manager bug This issue is a bug. in-progress This issue is being actively worked on. p2

Comments

@nsvarich
Copy link

nsvarich commented Feb 3, 2020

As of this morning (Feb 3, 2020) a CDK stack deploy that previously worked, started failing with a Service: AmazonElasticLoadBalancingV2; Status Code: 400; Error Code: CertificateNotFound;

The AWS Certificate Manager console shows the certificate stuck in a Pending Validation state (with Validation Status: Success). I'm guessing this is the root cause of the issue?

I've tried to deploy several times over the last 3 hours with the same error.

Reproduction Steps

Deploy a CDK stack with the following:

const certificate = new DnsValidatedCertificate(stack, 'Cert', {
    domainName,
    hostedZone
});

const lb = new elbv2.ApplicationLoadBalancer(stack, 'ALB', {
    vpc,
    internetFacing: true,
    securityGroup
});

const listener = lb.addListener(getId(resourceMoniker, 'Listener'), {
    port: 443,
    protocol: elbv2.ApplicationProtocol.HTTPS,
    open: false,
    certificateArns: [certificate.certificateArn],
});

Error Log

 13/16 | 10:24:19 PM | CREATE_FAILED        | AWS::ElasticLoadBalancingV2::Listener     | Fargate-
Test-ALB/Fargate-Test-Listener (FargateTestALBFargateTestListenerDDAC2B18) Certificate 
'arn:aws:acm:us-west-1:<account>:certificate/<id>' not found (Service: 
AmazonElasticLoadBalancingV2; Status Code: 400; Error Code: CertificateNotFound; Request ID: 
2747ec92-de97-4e37-890c-06485abcb879)

Environment

  • CLI Version : 1.20.0
  • Framework Version: 1.20.0
  • OS : Ubuntu 18.04
  • Language : English

Other


This is 🐛 Bug Report

@nsvarich nsvarich added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Feb 3, 2020
@SomayaB SomayaB added the @aws-cdk/aws-elasticloadbalancing Related to Amazon Elastic Load Balancing label Feb 4, 2020
@rix0rrr
Copy link
Contributor

rix0rrr commented Feb 4, 2020

I don't know why this is happening, but I think it might be a bit of a stretch to call it a CDK bug without further evidence.

You mentioned the stack deployed before. Did the CDK version change in the mean time? Did the template change?

The thing to do would be to figure out why your certificate didn't validate. You must be destroying+deploying it, instead of updating, if the certificate is getting recreated. Are you sure you're not hitting account limits?

If anything, the stack deployment should have failed on creating the certificate, if there's a bug it's that we pretended that the certificate creation succeeded. That's not going to help you get your cert created, but that's what I'm repurposing this ticket into.

@rix0rrr rix0rrr added @aws-cdk/aws-certificatemanager Related to Amazon Certificate Manager p2 and removed @aws-cdk/aws-elasticloadbalancing Related to Amazon Elastic Load Balancing labels Feb 4, 2020
@rix0rrr rix0rrr changed the title ApplicationLoadBalancer.addListener fails with certificate not found error DnsValidatedCertificate does not fail if certificate is both "pending validation" and "validation: success" Feb 4, 2020
@rix0rrr
Copy link
Contributor

rix0rrr commented Feb 4, 2020

The combination of states "pending" and "success" is very odd to me, so it might also have been an ACM hiccup. Have you checked the health dashboard?

@rix0rrr rix0rrr assigned skinny85 and unassigned rix0rrr Feb 4, 2020
@nsvarich
Copy link
Author

nsvarich commented Feb 4, 2020

I just confirmed the problem has gone away as of this morning by simply re-running the same stack deploy, so I think you're right it must've been an ACM hiccup (though the health dashboard didn't show anything). Appreciate the quick response!

@sousmangoosta
Copy link

Same bug for me @rix0rrr .

If you take a look on the waiter, we are waiting for Certificate.DomainValidationOptions[].ValidationStatus be "SUCCESS" to return success
Here it is : https://github.com/aws/aws-sdk-js/blob/master/apis/acm-2015-12-08.waiters2.json
but when the dns validation is success, the certificate can be not ISSUED, have a look here : aws/aws-sdk-js#2920

I think you can ovveride in the WaiterConfiguration interface to wait on Certificate.Status to be on ISSUED state, or ask for modification (or creation of new waiter) on the sdk-js project.

What do you think about this guys and girls ?

@jogold
Copy link
Contributor

jogold commented Feb 12, 2020

I think that a rewrite of this custom resource using an async provider from the custom resource framework (@aws-cdk/custom-resources) would solve all issues here (+ would make code cleaner).

@SomayaB SomayaB removed the needs-triage This issue or PR still needs to be triaged. label Mar 4, 2020
jogold added a commit to jogold/aws-cdk that referenced this issue Jun 15, 2020
…icate

Automatically adding Amazon Route 53 CNAME records for DNS validation is
now natively supported by CloudFormation.

Add a `validation` prop to `Certificate` to handle both email and DNS
validation. Deprecate `DnsValidatedCertificate`.

The default remains email validation (non-breaking).

Closes aws#5831
Closes aws#5835
Closes aws#6081
Closes aws#6516
Closes aws#7150
Closes aws#7941
Closes aws#7995
Closes aws#7996
jogold added a commit to jogold/aws-cdk that referenced this issue Jun 15, 2020
…cate

Automatically adding Amazon Route 53 CNAME records for DNS validation is
now natively supported by CloudFormation.

Add a `validation` prop to `Certificate` to handle both email and DNS
validation. Deprecate `DnsValidatedCertificate`.

The default remains email validation (non-breaking).

Closes aws#5831
Closes aws#5835
Closes aws#6081
Closes aws#6516
Closes aws#7150
Closes aws#7941
Closes aws#7995
Closes aws#7996
@SomayaB SomayaB added the in-progress This issue is being actively worked on. label Jun 15, 2020
@mergify mergify bot closed this as completed in #8552 Jul 10, 2020
mergify bot pushed a commit that referenced this issue Jul 10, 2020
…cate (#8552)

Automatically adding Amazon Route 53 CNAME records for DNS validation is
now natively supported by CloudFormation.

Add a `validation` prop to `Certificate` to handle both email and DNS
validation. `DnsValidatedCertificate` is now only useful for cross-region
certificate creation.

The default remains email validation (non-breaking).

Closes #5831
Closes #5835
Closes #6081
Closes #6516
Closes #7150
Closes #7941
Closes #7995
Closes #7996
Closes #8282 
Closes #8659
Closes #8783

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-certificatemanager Related to Amazon Certificate Manager bug This issue is a bug. in-progress This issue is being actively worked on. p2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants