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: Switch CallerReference from time.Now() to resource.UniqueId() #9470

Merged
merged 1 commit into from
Jul 24, 2019

Conversation

bflad
Copy link
Contributor

@bflad bflad commented Jul 24, 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 #9434

Release note for CHANGELOG:

* resource/aws_cloudfront_distribution: Prevent `DistributionAlreadyExists` errors during concurrent distribution creation 

Output from acceptance testing:

--- PASS: TestAccAWSCloudFrontDistribution_Origin_EmptyOriginID (4.95s)
--- PASS: TestAccAWSCloudFrontDistribution_Origin_EmptyDomainName (5.08s)
--- PASS: TestAccAWSCloudFrontDistribution_OrderedCacheBehavior_ForwardedValues_Headers (1567.50s)
--- PASS: TestAccAWSCloudFrontDistribution_OrderedCacheBehavior_ForwardedValues_Cookies_WhitelistedNames (1569.28s)
--- PASS: TestAccAWSCloudFrontDistribution_disappears (1574.60s)
--- PASS: TestAccAWSCloudFrontDistribution_DefaultCacheBehavior_ForwardedValues_Headers (1575.19s)
--- PASS: TestAccAWSCloudFrontDistribution_DefaultCacheBehavior_ForwardedValues_Cookies_WhitelistedNames (3398.76s)
--- PASS: TestAccAWSCloudFrontDistribution_orderedCacheBehavior (3567.88s)
--- PASS: TestAccAWSCloudFrontDistribution_OriginGroups (3562.87s)
--- PASS: TestAccAWSCloudFrontDistribution_IsIPV6EnabledConfig (3570.24s)
--- PASS: TestAccAWSCloudFrontDistribution_RetainOnDelete (3571.87s)
--- PASS: TestAccAWSCloudFrontDistribution_noOptionalItemsConfig (3575.29s)
--- PASS: TestAccAWSCloudFrontDistribution_WaitForDeployment (3571.28s)
--- PASS: TestAccAWSCloudFrontDistribution_noCustomErrorResponseConfig (3577.28s)
--- PASS: TestAccAWSCloudFrontDistribution_ViewerCertificate_AcmCertificateArn_ConflictsWithCloudFrontDefaultCertificate (3581.27s)
--- PASS: TestAccAWSCloudFrontDistribution_ViewerCertificate_AcmCertificateArn (3584.68s)
--- PASS: TestAccAWSCloudFrontDistribution_customOrigin (4291.01s)
--- PASS: TestAccAWSCloudFrontDistribution_HTTP11Config (4294.31s)
--- PASS: TestAccAWSCloudFrontDistribution_S3Origin (4368.65s)
--- PASS: TestAccAWSCloudFrontDistribution_multiOrigin (4371.62s)
--- PASS: TestAccAWSCloudFrontDistribution_Enabled (4464.73s)
--- PASS: TestAccAWSCloudFrontDistribution_S3OriginWithTags (4466.44s)

…e.Now() to resource.UniqueId()

Reference: #9434

Output from acceptance testing:

```
--- PASS: TestAccAWSCloudFrontDistribution_Origin_EmptyOriginID (4.95s)
--- PASS: TestAccAWSCloudFrontDistribution_Origin_EmptyDomainName (5.08s)
--- PASS: TestAccAWSCloudFrontDistribution_OrderedCacheBehavior_ForwardedValues_Headers (1567.50s)
--- PASS: TestAccAWSCloudFrontDistribution_OrderedCacheBehavior_ForwardedValues_Cookies_WhitelistedNames (1569.28s)
--- PASS: TestAccAWSCloudFrontDistribution_disappears (1574.60s)
--- PASS: TestAccAWSCloudFrontDistribution_DefaultCacheBehavior_ForwardedValues_Headers (1575.19s)
--- PASS: TestAccAWSCloudFrontDistribution_DefaultCacheBehavior_ForwardedValues_Cookies_WhitelistedNames (3398.76s)
--- PASS: TestAccAWSCloudFrontDistribution_orderedCacheBehavior (3567.88s)
--- PASS: TestAccAWSCloudFrontDistribution_OriginGroups (3562.87s)
--- PASS: TestAccAWSCloudFrontDistribution_IsIPV6EnabledConfig (3570.24s)
--- PASS: TestAccAWSCloudFrontDistribution_RetainOnDelete (3571.87s)
--- PASS: TestAccAWSCloudFrontDistribution_noOptionalItemsConfig (3575.29s)
--- PASS: TestAccAWSCloudFrontDistribution_WaitForDeployment (3571.28s)
--- PASS: TestAccAWSCloudFrontDistribution_noCustomErrorResponseConfig (3577.28s)
--- PASS: TestAccAWSCloudFrontDistribution_ViewerCertificate_AcmCertificateArn_ConflictsWithCloudFrontDefaultCertificate (3581.27s)
--- PASS: TestAccAWSCloudFrontDistribution_ViewerCertificate_AcmCertificateArn (3584.68s)
--- PASS: TestAccAWSCloudFrontDistribution_customOrigin (4291.01s)
--- PASS: TestAccAWSCloudFrontDistribution_HTTP11Config (4294.31s)
--- PASS: TestAccAWSCloudFrontDistribution_S3Origin (4368.65s)
--- PASS: TestAccAWSCloudFrontDistribution_multiOrigin (4371.62s)
--- PASS: TestAccAWSCloudFrontDistribution_Enabled (4464.73s)
--- PASS: TestAccAWSCloudFrontDistribution_S3OriginWithTags (4466.44s)
```
@bflad bflad added bug Addresses a defect in current functionality. service/cloudfront Issues and PRs that pertain to the cloudfront service. labels Jul 24, 2019
@bflad bflad requested a review from a team July 24, 2019 01:59
@ghost ghost added the size/XS Managed by automation to categorize the size of a PR. label Jul 24, 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.

LGTM 👍 👍

@bflad bflad added this to the v2.21.0 milestone Jul 24, 2019
@bflad
Copy link
Contributor Author

bflad commented Jul 24, 2019

Sorry, I realize that I should probably mention why this change works. 😅 resource.UniqueId() implements a monotonic counter so ID collisions across resources are extremely unlikely. 👍

@bflad bflad merged commit 92ac539 into master Jul 24, 2019
@bflad bflad deleted the b-aws_cloudfront_distribution-CallerReference branch July 24, 2019 14:06
bflad added a commit that referenced this pull request Jul 24, 2019
bflad added a commit that referenced this pull request Jul 24, 2019
…) usage with resource.UniqueId()

Reference: #9470

The implementation of `resource.UniqueId()` includes a monotonic counter, so it is safer for concurrent operations.

Output from acceptance testing:

```
--- PASS: TestAccAWSCloudFrontPublicKey_namePrefix (10.06s)
--- PASS: TestAccAWSCloudFrontPublicKey_basic (10.11s)
--- PASS: TestAccAWSCloudFrontPublicKey_update (16.13s)
```
bflad added a commit that referenced this pull request Jul 24, 2019
…ce time.Now() usage with resource.UniqueId()

Reference: #9470

The implementation of `resource.UniqueId()` includes a monotonic counter, so it is safer for concurrent operations.

Output from acceptance testing:

```
--- PASS: TestAccAWSCloudFrontOriginAccessIdentity_basic (9.81s)
--- PASS: TestAccAWSCloudFrontOriginAccessIdentity_noComment (10.25s)
--- PASS: TestAccAWSCloudFrontOriginAccessIdentity_importBasic (10.54s)
```
bflad added a commit that referenced this pull request Jul 24, 2019
…Now() usage with resource.UniqueId()

Reference: #9470

The implementation of `resource.UniqueId()` includes a monotonic counter, so it is safer for concurrent operations.

Output from acceptance testing:

```
--- PASS: TestAccAWSServiceCatalogPortfolio_Disappears (10.62s)
--- PASS: TestAccAWSServiceCatalogPortfolio_Import (13.26s)
--- PASS: TestAccAWSServiceCatalogPortfolio_Basic (29.31s)
```
bflad added a commit that referenced this pull request Jul 24, 2019
…ency protection fields such as CallerReference and IdempotencyToken

Reference: #9470
@bflad
Copy link
Contributor Author

bflad commented Jul 26, 2019

This has been released in version 2.21.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, documentation updates, or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

@ghost
Copy link

ghost commented Nov 2, 2019

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 Nov 2, 2019
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. service/cloudfront Issues and PRs that pertain to the cloudfront service. size/XS Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DistributionAlreadyExists while creating multiple CloudFront distributions
2 participants