-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
resource/aws_cloudfront_distribution: Add wait_for_deployment argument #8116
Conversation
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) ```
…gument documentation
}, | ||
} | ||
|
||
for tn, tc := range cases { |
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.
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.
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.
👍 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`. |
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.
@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
.
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.
👍 great suggestion, will update.
…e naming and improve wait_for_deployment documentation Reference: #8116
Thanks for giving us the option to skip! This is great 👍 |
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 👍
@bflad Why is default behavior 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... :( |
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. |
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. |
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
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: