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_cloudfront_distribution: Ensure retain_on_delete disables the CloudFront Distribution before exiting #7875

Merged
merged 2 commits into from
Mar 14, 2019

Conversation

bflad
Copy link
Contributor

@bflad bflad commented Mar 8, 2019

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" comments, they generate extra noise for pull request followers and do not help prioritize the request

Fixes #7869

Split into two commits for your reviewing pleasure, where the first just saves the API object from the Exists function. This adds covering acceptance testing for the following:

  • CloudFront Distributions deleted outside Terraform
  • enabled = true|false
  • retain_on_delete = true

Output from acceptance testing:

--- PASS: TestAccAWSCloudFrontDistribution_Origin_EmptyOriginID (2.02s)
--- PASS: TestAccAWSCloudFrontDistribution_Origin_EmptyDomainName (2.06s)
--- PASS: TestAccAWSCloudFrontDistribution_disappears (1067.66s)
--- PASS: TestAccAWSCloudFrontDistribution_ViewerCertificate_AcmCertificateArn_ConflictsWithCloudFrontDefaultCertificate (1685.28s)
--- PASS: TestAccAWSCloudFrontDistribution_ViewerCertificate_AcmCertificateArn (1685.66s)
--- PASS: TestAccAWSCloudFrontDistribution_IsIPV6EnabledConfig (2111.96s)
--- PASS: TestAccAWSCloudFrontDistribution_orderedCacheBehavior (2111.97s)
--- PASS: TestAccAWSCloudFrontDistribution_HTTP11Config (2113.64s)
--- PASS: TestAccAWSCloudFrontDistribution_noCustomErrorResponseConfig (2115.80s)
--- PASS: TestAccAWSCloudFrontDistribution_noOptionalItemsConfig (2118.65s)
--- PASS: TestAccAWSCloudFrontDistribution_multiOrigin (2139.74s)
--- PASS: TestAccAWSCloudFrontDistribution_RetainOnDelete (2142.37s)
--- PASS: TestAccAWSCloudFrontDistribution_customOrigin (2142.99s)
--- PASS: TestAccAWSCloudFrontDistribution_S3Origin (2143.78s)
--- PASS: TestAccAWSCloudFrontDistribution_S3OriginWithTags (3188.18s)
--- PASS: TestAccAWSCloudFrontDistribution_Enabled (3196.45s)

…ts functions for consistency with other resources and return API object

Output from acceptance testing:

```
--- PASS: TestAccAWSCloudFrontDistribution_Origin_EmptyDomainName (2.11s)
--- PASS: TestAccAWSCloudFrontDistribution_Origin_EmptyOriginID (2.18s)
--- PASS: TestAccAWSCloudFrontDistribution_ViewerCertificate_AcmCertificateArn_ConflictsWithCloudFrontDefaultCertificate (1756.66s)
--- PASS: TestAccAWSCloudFrontDistribution_ViewerCertificate_AcmCertificateArn (1756.94s)
--- PASS: TestAccAWSCloudFrontDistribution_IsIPV6EnabledConfig (2103.17s)
--- PASS: TestAccAWSCloudFrontDistribution_noOptionalItemsConfig (2104.28s)
--- PASS: TestAccAWSCloudFrontDistribution_HTTP11Config (2107.70s)
--- PASS: TestAccAWSCloudFrontDistribution_orderedCacheBehavior (2110.84s)
--- PASS: TestAccAWSCloudFrontDistribution_noCustomErrorResponseConfig (2110.91s)
--- PASS: TestAccAWSCloudFrontDistribution_S3Origin (2187.11s)
--- PASS: TestAccAWSCloudFrontDistribution_customOrigin (2192.35s)
--- PASS: TestAccAWSCloudFrontDistribution_multiOrigin (2192.63s)
--- PASS: TestAccAWSCloudFrontDistribution_S3OriginWithTags (3296.57s)
```
…s the CloudFront Distribution before exiting

Reference: #7869

This adds covering acceptance testing for the following:

* CloudFront Distributions deleted outside Terraform
* enabled = true|false
* retain_on_delete = true

Output from acceptance testing:

```
--- PASS: TestAccAWSCloudFrontDistribution_Origin_EmptyOriginID (2.02s)
--- PASS: TestAccAWSCloudFrontDistribution_Origin_EmptyDomainName (2.06s)
--- PASS: TestAccAWSCloudFrontDistribution_disappears (1067.66s)
--- PASS: TestAccAWSCloudFrontDistribution_ViewerCertificate_AcmCertificateArn_ConflictsWithCloudFrontDefaultCertificate (1685.28s)
--- PASS: TestAccAWSCloudFrontDistribution_ViewerCertificate_AcmCertificateArn (1685.66s)
--- PASS: TestAccAWSCloudFrontDistribution_IsIPV6EnabledConfig (2111.96s)
--- PASS: TestAccAWSCloudFrontDistribution_orderedCacheBehavior (2111.97s)
--- PASS: TestAccAWSCloudFrontDistribution_HTTP11Config (2113.64s)
--- PASS: TestAccAWSCloudFrontDistribution_noCustomErrorResponseConfig (2115.80s)
--- PASS: TestAccAWSCloudFrontDistribution_noOptionalItemsConfig (2118.65s)
--- PASS: TestAccAWSCloudFrontDistribution_multiOrigin (2139.74s)
--- PASS: TestAccAWSCloudFrontDistribution_RetainOnDelete (2142.37s)
--- PASS: TestAccAWSCloudFrontDistribution_customOrigin (2142.99s)
--- PASS: TestAccAWSCloudFrontDistribution_S3Origin (2143.78s)
--- PASS: TestAccAWSCloudFrontDistribution_S3OriginWithTags (3188.18s)
--- PASS: TestAccAWSCloudFrontDistribution_Enabled (3196.45s)
```
@bflad bflad added bug Addresses a defect in current functionality. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. service/cloudfront Issues and PRs that pertain to the cloudfront service. labels Mar 8, 2019
@bflad bflad requested a review from a team March 8, 2019 22:01
@ghost ghost added size/XL Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Mar 8, 2019
Copy link
Contributor

@nywilken nywilken left a comment

Choose a reason for hiding this comment

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

Nicely done! Thank you for the separating the commits.

@nywilken nywilken merged commit 0ea4b33 into master Mar 14, 2019
@nywilken nywilken deleted the b-aws_cloudfront_distribution-retain_on_delete branch March 14, 2019 21:51
nywilken added a commit that referenced this pull request Mar 14, 2019
@bflad bflad added this to the v2.2.0 milestone Mar 15, 2019
@bflad
Copy link
Contributor Author

bflad commented Mar 15, 2019

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

@ghost
Copy link

ghost commented Mar 31, 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 Mar 31, 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. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. service/cloudfront Issues and PRs that pertain to the cloudfront service. size/XL Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Since March 7th update aws_cloudfront_distribution retain_on_delete=true no longer works
2 participants