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: Add wait_for_deployment argument #8116

Merged

Conversation

bflad
Copy link
Contributor

@bflad bflad commented Mar 28, 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

Closes #8073

Since we are adding a virtual attribute with a Default, we must include a schema state migration to prevent the "" => "true" difference on upgrade.

Output from acceptance testing:

--- PASS: TestAccAWSCloudFrontDistribution_Origin_EmptyDomainName (1.25s)
--- PASS: TestAccAWSCloudFrontDistribution_Origin_EmptyOriginID (1.30s)
--- PASS: TestAccAWSCloudFrontDistribution_disappears (571.01s)
--- PASS: TestAccAWSCloudFrontDistribution_noOptionalItemsConfig (1263.05s)
--- PASS: TestAccAWSCloudFrontDistribution_noCustomErrorResponseConfig (1265.06s)
--- PASS: TestAccAWSCloudFrontDistribution_HTTP11Config (1265.34s)
--- PASS: TestAccAWSCloudFrontDistribution_customOrigin (1267.09s)
--- PASS: TestAccAWSCloudFrontDistribution_OriginGroups (1267.68s)
--- PASS: TestAccAWSCloudFrontDistribution_RetainOnDelete (1268.95s)
--- PASS: TestAccAWSCloudFrontDistribution_orderedCacheBehavior (1271.12s)
--- PASS: TestAccAWSCloudFrontDistribution_S3Origin (1271.30s)
--- PASS: TestAccAWSCloudFrontDistribution_multiOrigin (1271.50s)
--- PASS: TestAccAWSCloudFrontDistribution_IsIPV6EnabledConfig (1272.82s)
--- PASS: TestAccAWSCloudFrontDistribution_ViewerCertificate_AcmCertificateArn (1275.16s)
--- PASS: TestAccAWSCloudFrontDistribution_WaitForDeployment (1275.81s)
--- PASS: TestAccAWSCloudFrontDistribution_ViewerCertificate_AcmCertificateArn_ConflictsWithCloudFrontDefaultCertificate (1372.94s)
--- PASS: TestAccAWSCloudFrontDistribution_S3OriginWithTags (1782.07s)
--- PASS: TestAccAWSCloudFrontDistribution_Enabled (1782.38s)

Reference: #8073

Since we are adding a virtual attribute with a `Default`, we must use include a schema state migration to prevent the `"" => "true"` difference on upgrade.

Output from acceptance testing:

```
--- PASS: TestAccAWSCloudFrontDistribution_Origin_EmptyDomainName (1.25s)
--- PASS: TestAccAWSCloudFrontDistribution_Origin_EmptyOriginID (1.30s)
--- PASS: TestAccAWSCloudFrontDistribution_disappears (571.01s)
--- PASS: TestAccAWSCloudFrontDistribution_noOptionalItemsConfig (1263.05s)
--- PASS: TestAccAWSCloudFrontDistribution_noCustomErrorResponseConfig (1265.06s)
--- PASS: TestAccAWSCloudFrontDistribution_HTTP11Config (1265.34s)
--- PASS: TestAccAWSCloudFrontDistribution_customOrigin (1267.09s)
--- PASS: TestAccAWSCloudFrontDistribution_OriginGroups (1267.68s)
--- PASS: TestAccAWSCloudFrontDistribution_RetainOnDelete (1268.95s)
--- PASS: TestAccAWSCloudFrontDistribution_orderedCacheBehavior (1271.12s)
--- PASS: TestAccAWSCloudFrontDistribution_S3Origin (1271.30s)
--- PASS: TestAccAWSCloudFrontDistribution_multiOrigin (1271.50s)
--- PASS: TestAccAWSCloudFrontDistribution_IsIPV6EnabledConfig (1272.82s)
--- PASS: TestAccAWSCloudFrontDistribution_ViewerCertificate_AcmCertificateArn (1275.16s)
--- PASS: TestAccAWSCloudFrontDistribution_WaitForDeployment (1275.81s)
--- PASS: TestAccAWSCloudFrontDistribution_ViewerCertificate_AcmCertificateArn_ConflictsWithCloudFrontDefaultCertificate (1372.94s)
--- PASS: TestAccAWSCloudFrontDistribution_S3OriginWithTags (1782.07s)
--- PASS: TestAccAWSCloudFrontDistribution_Enabled (1782.38s)
```
@bflad bflad added enhancement Requests to existing resources that expand the functionality or scope. service/cloudfront Issues and PRs that pertain to the cloudfront service. labels Mar 28, 2019
@bflad bflad requested a review from a team March 28, 2019 16:38
@ghost ghost added tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. size/XL Managed by automation to categorize the size of a PR. labels Mar 28, 2019
},
}

for tn, tc := range cases {
Copy link
Contributor

Choose a reason for hiding this comment

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

The variable names are a bit confusing here. I would stick with the std. i for index so that we don't have to think what it means sometime in the future. I would apply this thinking to any other variable that makes you think for more than two seconds.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 will update these. We should consider updating the rest of the codebase too as this was mostly copied from elsewhere.

@@ -255,6 +255,10 @@ of several sub-resources - these resources are laid out below.
deleting it when destroying the resource through Terraform. If this is set,
the distribution needs to be deleted manually afterwards. Default: `false`.

* `wait_for_deployment` (Optional) - By default, the resource will wait
for creation and updates to fully deploy. Setting this to `false`
will skip waiting for deployments to complete. Default: `true`.
Copy link

Choose a reason for hiding this comment

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

@bflad I would suggest this to read instead so it's clear what's happening here:

If enabled, the resource will wait for the distribution status to change from InProgress to Deployed.
Setting this to false will skip the process. Default: true.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 great suggestion, will update.

…e naming and improve wait_for_deployment documentation

Reference: #8116
@nathanielks
Copy link
Contributor

Thanks for giving us the option to skip! This is great 👍

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.

LGTM 👍

@bflad bflad added this to the v2.5.0 milestone Apr 1, 2019
@bflad bflad merged commit 15b99f2 into master Apr 1, 2019
@bflad bflad deleted the f-aws_cloudfront_distribution-skip_wait_for_deployment branch April 1, 2019 16:10
bflad added a commit that referenced this pull request Apr 1, 2019
@DJAlPee
Copy link

DJAlPee commented Apr 3, 2019

@bflad Why is default behavior true and not false?

Before introducing this new feature, the default behavior was not waiting for the complete deployment to be finished. To stick with this behavior, I now have to change every configuration, where I use cloudfront... :(

@bflad
Copy link
Contributor Author

bflad commented Apr 3, 2019

Hi @DJAlPee 👋 Sorry for the hassle as CloudFront deployments are particularly long as compared with many other AWS resources.

A design philosophy with most Terraform resources is that they should be designed to wait until they have completed any creation/update/deletion action. This is so any downstream Terraform configuration or post-Terraform actions that are intending to interact with the infrastructure does so when the infrastructure is in a stable state. Where this waiting behavior does not happen we typically consider that to be a bug in the Terraform resource and do not consider it a breaking change as we were not previously performing an expected Terraform resource behavior.

If you have suggestions where we might be able to document these concepts better, we would gladly take a look, just please submit a new GitHub issue so it doesn't get lost in a previously closed issue/pull request.

@bflad
Copy link
Contributor Author

bflad commented Apr 5, 2019

This has been released in version 2.5.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 30, 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 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. enhancement Requests to existing resources that expand the functionality or scope. 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
5 participants