-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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_cloudfront_distribution: Remove extraneous aliases configurations and create aliased us-east-1 provider configuration #8314
Merged
nywilken
merged 1 commit into
master
from
td-aws_cloudfront_distribution-alias-verification
Apr 26, 2019
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… configurations and create aliased us-east-1 provider configuration On April 8th, 2019, [Amazon CloudFront began validating alternate domain names](https://aws.amazon.com/about-aws/whats-new/2019/04/amazon-cloudfront-enhances-the-security-for-adding-alternate-domain-names-to-a-distribution/) for security reasons. Some of our acceptance testing was extraneously assigning aliases to CloudFront distributions configured with the CloudFront default certificate and began failing as a result of this service update. Previous output from acceptance testing: ``` --- FAIL: TestAccAWSCloudFrontDistribution_S3Origin (95.64s) testing.go:538: Step 0 error: Error applying: 1 error occurred: * aws_cloudfront_distribution.s3_distribution: 1 error occurred: * aws_cloudfront_distribution.s3_distribution: error creating CloudFront Distribution: InvalidViewerCertificate: To add an alternate domain name (CNAME) to a CloudFront distribution, you must attach a trusted certificate that validates your authorization to use the domain name. For more details, see: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/CNAMEs.html#alternate-domain-names-requirements --- FAIL: TestAccAWSCloudFrontDistribution_S3OriginWithTags (95.90s) testing.go:538: Step 0 error: Error applying: 1 error occurred: * aws_cloudfront_distribution.s3_distribution: 1 error occurred: * aws_cloudfront_distribution.s3_distribution: error creating CloudFront Distribution: InvalidViewerCertificate: To add an alternate domain name (CNAME) to a CloudFront distribution, you must attach a trusted certificate that validates your authorization to use the domain name. For more details, see: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/CNAMEs.html#alternate-domain-names-requirements --- FAIL: TestAccAWSCloudFrontDistribution_customOrigin (65.61s) testing.go:538: Step 0 error: Error applying: 1 error occurred: * aws_cloudfront_distribution.custom_distribution: 1 error occurred: * aws_cloudfront_distribution.custom_distribution: error creating CloudFront Distribution: InvalidViewerCertificate: To add an alternate domain name (CNAME) to a CloudFront distribution, you must attach a trusted certificate that validates your authorization to use the domain name. For more details, see: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/CNAMEs.html#alternate-domain-names-requirements --- FAIL: TestAccAWSCloudFrontDistribution_multiOrigin (95.68s) testing.go:538: Step 0 error: Error applying: 1 error occurred: * aws_cloudfront_distribution.multi_origin_distribution: 1 error occurred: * aws_cloudfront_distribution.multi_origin_distribution: error creating CloudFront Distribution: InvalidViewerCertificate: To add an alternate domain name (CNAME) to a CloudFront distribution, you must attach a trusted certificate that validates your authorization to use the domain name. For more details, see: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/CNAMEs.html#alternate-domain-names-requirements ``` This change simply removes the `aws_cloudfront_distribution` resource `aliases` configurations, which are not meaningful in these acceptance tests. We also remove the hardcoded `us-east-1` region provider used for ACM certificate handling as it can break other acceptance testing when run concurrently (e.g. locally with `go test -parallel`): ``` --- FAIL: TestAccAWSCloudFrontDistribution_OriginGroups (1247.64s) testing.go:599: Error destroying resource! WARNING: Dangling resources may exist. The full state and error is shown below. Error: Error applying: 2 errors occurred: * aws_s3_bucket.s3_bucket_origin (destroy): 1 error occurred: * aws_s3_bucket.s3_bucket_origin: error deleting S3 Bucket (mybucket.6479347118024743098): BucketRegionError: incorrect region, the bucket is not in 'us-east-1' region at endpoint '' status code: 301, request id: , host id: * aws_s3_bucket.s3_backup_bucket_origin (destroy): 1 error occurred: * aws_s3_bucket.s3_backup_bucket_origin: error deleting S3 Bucket (mybucket-backup.6479347118024743098): BucketRegionError: incorrect region, the bucket is not in 'us-east-1' region at endpoint '' status code: 301, request id: , host id: ``` The aliased `us-east-1` provider configuration will be applied to other test configuration usage later. Output from acceptance testing: ``` --- PASS: TestAccAWSCloudFrontDistribution_Origin_EmptyOriginID (2.11s) --- PASS: TestAccAWSCloudFrontDistribution_Origin_EmptyDomainName (2.21s) --- PASS: TestAccAWSCloudFrontDistribution_DefaultCacheBehavior_ForwardedValues_Cookies_WhitelistedNames (590.42s) --- PASS: TestAccAWSCloudFrontDistribution_OrderedCacheBehavior_ForwardedValues_Cookies_WhitelistedNames (592.18s) --- PASS: TestAccAWSCloudFrontDistribution_DefaultCacheBehavior_ForwardedValues_Headers (592.31s) --- PASS: TestAccAWSCloudFrontDistribution_disappears (592.72s) --- PASS: TestAccAWSCloudFrontDistribution_OrderedCacheBehavior_ForwardedValues_Headers (594.33s) --- PASS: TestAccAWSCloudFrontDistribution_ViewerCertificate_AcmCertificateArn (1187.55s) --- PASS: TestAccAWSCloudFrontDistribution_ViewerCertificate_AcmCertificateArn_ConflictsWithCloudFrontDefaultCertificate (1187.67s) --- PASS: TestAccAWSCloudFrontDistribution_RetainOnDelete (1225.22s) --- PASS: TestAccAWSCloudFrontDistribution_orderedCacheBehavior (1225.58s) --- PASS: TestAccAWSCloudFrontDistribution_HTTP11Config (1226.33s) --- PASS: TestAccAWSCloudFrontDistribution_multiOrigin (1227.19s) --- PASS: TestAccAWSCloudFrontDistribution_noOptionalItemsConfig (1229.81s) --- PASS: TestAccAWSCloudFrontDistribution_S3Origin (1230.36s) --- PASS: TestAccAWSCloudFrontDistribution_noCustomErrorResponseConfig (1232.47s) --- PASS: TestAccAWSCloudFrontDistribution_OriginGroups (1232.59s) --- PASS: TestAccAWSCloudFrontDistribution_customOrigin (1231.23s) --- PASS: TestAccAWSCloudFrontDistribution_WaitForDeployment (1233.12s) --- PASS: TestAccAWSCloudFrontDistribution_IsIPV6EnabledConfig (1234.68s) --- PASS: TestAccAWSCloudFrontDistribution_Enabled (1728.08s) --- PASS: TestAccAWSCloudFrontDistribution_S3OriginWithTags (1787.54s) ```
bflad
added
tests
PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
service/cloudfront
Issues and PRs that pertain to the cloudfront service.
labels
Apr 15, 2019
nywilken
approved these changes
Apr 26, 2019
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 👍 👍
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
locked and limited conversation to collaborators
Mar 30, 2020
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
service/cloudfront
Issues and PRs that pertain to the cloudfront service.
size/S
Managed by automation to categorize the size of a PR.
tests
PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Community Note
On April 8th, 2019, Amazon CloudFront began validating alternate domain names for security reasons. Some of our acceptance testing was extraneously assigning aliases to CloudFront distributions configured with the CloudFront default certificate and began failing as a result of this service update.
Previous output from acceptance testing:
This change simply removes the
aws_cloudfront_distribution
resourcealiases
configurations, which are not meaningful in these acceptance tests. We also remove the hardcodedus-east-1
region provider used for ACM certificate handling as it can break other acceptance testing when run concurrently (e.g. locally withgo test -parallel
):The aliased
us-east-1
provider configuration will be applied to other test configuration usage later.Output from acceptance testing: