-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
tests/resource/aws_api_gateway_domain_name: Remove hardcoded environment variable handling, create public ACM certificate, improve state value checks #16139
Conversation
…ent variable handling, create public ACM certificate, improve state value checks Reference: #8316 Reference: #14664 Reference: #15737 Output from acceptance testing in AWS Commercial: ``` --- PASS: TestAccAWSAPIGatewayDomainName_disappears (20.54s) --- PASS: TestAccAWSAPIGatewayDomainName_RegionalCertificateArn (81.84s) --- PASS: TestAccAWSAPIGatewayDomainName_SecurityPolicy (139.42s) --- PASS: TestAccAWSAPIGatewayDomainName_Tags (203.73s) --- SKIP: TestAccAWSAPIGatewayDomainName_CertificateName (0.00s) --- SKIP: TestAccAWSAPIGatewayDomainName_RegionalCertificateName (0.00s) ``` Output from acceptance testing in AWS GovCloud (US) (other tests failing with ACM quota limits): ``` --- SKIP: TestAccAWSAPIGatewayDomainName_CertificateArn (1.58s) ```
…ting mutual TLS (relates: hashicorp#16139). Acceptance test output: $ ACM_CERTIFICATE_ROOT_DOMAIN=<domain name> make testacc TEST=./aws TESTARGS='-run=TestAccAWSAPIGatewayV2DomainName_' ==> Checking that code complies with gofmt requirements... TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSAPIGatewayV2DomainName_ -timeout 120m === RUN TestAccAWSAPIGatewayV2DomainName_basic === PAUSE TestAccAWSAPIGatewayV2DomainName_basic === RUN TestAccAWSAPIGatewayV2DomainName_disappears === PAUSE TestAccAWSAPIGatewayV2DomainName_disappears === RUN TestAccAWSAPIGatewayV2DomainName_Tags === PAUSE TestAccAWSAPIGatewayV2DomainName_Tags === RUN TestAccAWSAPIGatewayV2DomainName_UpdateCertificate === PAUSE TestAccAWSAPIGatewayV2DomainName_UpdateCertificate === RUN TestAccAWSAPIGatewayV2DomainName_MutualTlsAuthentication === PAUSE TestAccAWSAPIGatewayV2DomainName_MutualTlsAuthentication === CONT TestAccAWSAPIGatewayV2DomainName_basic === CONT TestAccAWSAPIGatewayV2DomainName_UpdateCertificate === CONT TestAccAWSAPIGatewayV2DomainName_MutualTlsAuthentication === CONT TestAccAWSAPIGatewayV2DomainName_Tags === CONT TestAccAWSAPIGatewayV2DomainName_disappears --- PASS: TestAccAWSAPIGatewayV2DomainName_disappears (22.46s) --- PASS: TestAccAWSAPIGatewayV2DomainName_Tags (83.52s) --- PASS: TestAccAWSAPIGatewayV2DomainName_MutualTlsAuthentication (207.72s) --- PASS: TestAccAWSAPIGatewayV2DomainName_basic (240.48s) --- PASS: TestAccAWSAPIGatewayV2DomainName_UpdateCertificate (758.06s) PASS ok github.com/terraform-providers/terraform-provider-aws/aws 758.484s
data "aws_route53_zone" "test" { | ||
name = %[1]q | ||
private_zone = false | ||
} | ||
|
||
resource "aws_acm_certificate" "test" { | ||
domain_name = %[2]q | ||
validation_method = "DNS" | ||
} | ||
|
||
# | ||
# for_each acceptance testing requires: | ||
# https://github.com/hashicorp/terraform-plugin-sdk/issues/536 | ||
# | ||
# resource "aws_route53_record" "test" { | ||
# for_each = { | ||
# for dvo in aws_acm_certificate.test.domain_validation_options: dvo.domain_name => { | ||
# name = dvo.resource_record_name | ||
# record = dvo.resource_record_value | ||
# type = dvo.resource_record_type | ||
# } | ||
# } | ||
|
||
# allow_overwrite = true | ||
# name = each.value.name | ||
# records = [each.value.record] | ||
# ttl = 60 | ||
# type = each.value.type | ||
# zone_id = data.aws_route53_zone.test.zone_id | ||
# } | ||
|
||
resource "aws_route53_record" "test" { | ||
allow_overwrite = true | ||
name = tolist(aws_acm_certificate.test.domain_validation_options)[0].resource_record_name | ||
records = [tolist(aws_acm_certificate.test.domain_validation_options)[0].resource_record_value] | ||
ttl = 60 | ||
type = tolist(aws_acm_certificate.test.domain_validation_options)[0].resource_record_type | ||
zone_id = data.aws_route53_zone.test.zone_id | ||
} | ||
|
||
resource "aws_acm_certificate_validation" "test" { | ||
certificate_arn = aws_acm_certificate.test.arn | ||
validation_record_fqdns = [aws_route53_record.test.fqdn] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, in #15258 I have pulled this into a separate function as I will use it in a couple of places: 4a7197b#diff-de07b61dfd6679fbda71d2c219efc2356d9a0757a6366304a5361ee09f86803bR395-R441.
If this PR is merged first I'll refactor testAccAWSAPIGatewayDomainNameConfig_CertificateArn
to use this new function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay cool -- feel free to add it to the contributing guide and create a followup technical debt issue. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done: #16171.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
$ ACM_CERTIFICATE_ROOT_DOMAIN=<domain name> make testacc TEST=./aws TESTARGS='-run=TestAccAWSAPIGatewayDomainName_CertificateArn'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSAPIGatewayDomainName_CertificateArn -timeout 120m
=== RUN TestAccAWSAPIGatewayDomainName_CertificateArn
=== PAUSE TestAccAWSAPIGatewayDomainName_CertificateArn
=== CONT TestAccAWSAPIGatewayDomainName_CertificateArn
--- PASS: TestAccAWSAPIGatewayDomainName_CertificateArn (963.01s)
PASS
ok github.com/terraform-providers/terraform-provider-aws/aws 963.079s
This has been released in version 3.15.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks! |
…ing mutual TLS (relates: hashicorp#16139). Acceptance test output: $ ACM_CERTIFICATE_ROOT_DOMAIN=<domain name> make testacc TEST=./aws TESTARGS='-run=TestAccAWSAPIGatewayDomainName_MutualTlsAuthentication' ==> Checking that code complies with gofmt requirements... TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSAPIGatewayDomainName_MutualTlsAuthentication -timeout 120m === RUN TestAccAWSAPIGatewayDomainName_MutualTlsAuthentication === PAUSE TestAccAWSAPIGatewayDomainName_MutualTlsAuthentication === CONT TestAccAWSAPIGatewayDomainName_MutualTlsAuthentication --- PASS: TestAccAWSAPIGatewayDomainName_MutualTlsAuthentication (151.06s) PASS ok github.com/terraform-providers/terraform-provider-aws/aws 151.102s
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! |
Community Note
Reference: #8316
Closes #14664
Reference: #15737
Release note for CHANGELOG:
Output from acceptance testing in AWS Commercial:
Output from acceptance testing in AWS GovCloud (US) (other tests failing with ACM quota limits):