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

resource/aws_acm_certificate_validation: Prevent crash on validation_record_fqdns #3336

Merged

Conversation

bflad
Copy link
Contributor

@bflad bflad commented Feb 12, 2018

Fixes #3330

Other changes:

  • Will retry until domain validation options are actually available when using validation_record_fqdns
  • Will now return an error if validation_record_fqdns is used on EMAIL validation method ACM certificates (with associated acceptance test)
  • Add docs example for email validation
  • Fix docs link to aws_acm_certificate resource instead of self-referencing
make testacc TEST=./aws TESTARGS='-run=TestAccAwsAcmCertificateValidation_basic'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -run=TestAccAwsAcmCertificateValidation_basic -timeout 120m
=== RUN   TestAccAwsAcmCertificateValidation_basic
--- PASS: TestAccAwsAcmCertificateValidation_basic (225.96s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	226.000s

…record_fqdns

Other changes:
* Will retry until domain validation options are actually available when using validation_record_fqdns
* Will now return an error if validation_record_fqdns is used on EMAIL validation method ACM certificates
* Add docs example for email validation
* Fix docs link to aws_acm_certificate instead of self-reference
@bflad bflad added bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. service/acm Issues and PRs that pertain to the acm service. labels Feb 12, 2018
@ghost ghost added the size/M Managed by automation to categorize the size of a PR. label Feb 12, 2018
@bflad bflad added this to the v1.10.0 milestone Feb 12, 2018
@cemo
Copy link

cemo commented Feb 12, 2018

@bflad Have you seen the #2813 (comment). This is pretty much limiting usage. Is it possible to fix this part as well?

Copy link
Member

@radeksimko radeksimko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cemo I think we should be fixing one bug at a time and this PR already has a large scope, so I'm happy for keeping it as is and fixing the mentioned thing in a separate PR.

Reviewing bigger PRs with multiple fixes is much more difficult and creates more room for error. It's IMO better to prevent introducing even more bugs that way.

@bflad I have mixed feelings about supporting email confirmations in general. I feel like it's out of the usual/expected scope of Terraform, because email confirmation is rarely well automated and letting user wait until someone clicks a link is odd.

That said I'm ok with this PR as it's fixing the crash and that's important.

CertificateArn: cert.CertificateArn,
}
err := resource.Retry(1*time.Minute, func() *resource.RetryError {
log.Printf("[DEBUG] Certificate domain validation options empty, retrying")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: Having the cert ARN in the log message would make it IMO more helpful.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh good catch! Will add

return resource.NonRetryableError(err)
}
if len(output.Certificate.DomainValidationOptions) == 0 {
return resource.RetryableError(errors.New("Certificate domain validation options empty"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: Likewise ^

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@bflad
Copy link
Contributor Author

bflad commented Feb 13, 2018

I have mixed feelings about supporting email confirmations in general. I feel like it's out of the usual/expected scope of Terraform, because email confirmation is rarely well automated and letting user wait until someone clicks a link is odd.

Me too and it certainly is 😂 but I imagine some (unfortunate) environments are stuck with email validation for whatever reason, so even if its janky, it provides them a starting path into Terraform usage. There's no technical reason to prevent it as the support on our end was simply allowing the additional validation method to pass through to the ACM API in the certificate resource and prevent email validation from working with this DNS-specific attribute in the validation resource. Email validation can timeout just the same as if ACM's DNS validation system has issues.

@ghost ghost added the size/M Managed by automation to categorize the size of a PR. label Feb 13, 2018
@bflad bflad merged commit 3412c46 into master Feb 13, 2018
@bflad bflad deleted the b-aws_acm_certificate_validation-validation-method-crash branch February 13, 2018 11:57
bflad added a commit that referenced this pull request Feb 13, 2018
@bflad
Copy link
Contributor Author

bflad commented Feb 27, 2018

This has been released in version 1.10.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@ghost
Copy link

ghost commented Apr 7, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. service/acm Issues and PRs that pertain to the acm service. size/M Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Terraform apply crashed when configuring aws_acm_certificate_validation
3 participants