-
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
resource/aws_cloudfront_distribution: Fix active_trusted_signers
attribute for Terraform 0.12
#10013
Conversation
…tribute for Terraform 0.12 Reference: #8902 This attribute implemented a legacy Terraform library (`flatmap`), which does not work with Terraform 0.12's data types and whose only usage was on this single attribute. This was missed during the Terraform 0.12 upgrade since there were no covering acceptance tests and the CloudFront setup itself is fairly esoteric (requires root AWS account login to manage CloudFront Keys). The attribute now correctly implements (in the closest approximation) the standard Terraform Provider SDK types and methodology for saved nested object data to the Terraform state. The `items` subattribute list is now accessible again in Terraform 0.12. It does, however, unavoidably switch the root `active_trusted_signers` attribute to `TypeList` instead of `TypeMap` (which does not support map elements of different types in the current Terraform Provider SDK), so any potential references to nested attributes will need to be changed in user configurations, e.g. Previously: ``` aws_cloudfront_distribution.example.active_trusted_signers.enabled ``` Now: ``` aws_cloudfront_distribution.example.active_trusted_signers.0.enabled ``` Output from acceptance testing: ``` --- PASS: TestAccAWSCloudFrontDistribution_DefaultCacheBehavior_TrustedSigners (611.33s) ```
…ctive_trusted_signers", ...) error Output from acceptance testing: ``` --- PASS: TestAccAWSCloudFrontDistribution_DefaultCacheBehavior_TrustedSigners ```
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 👍 👍
Is this something we should add a note to the changelog for?
Previously:
aws_cloudfront_distribution.example.active_trusted_signers.enabled
Now:
aws_cloudfront_distribution.example.active_trusted_signers.0.enabled
signer["key_pair_ids"] = aws.StringValueSlice(v.KeyPairIds.Items) | ||
s = append(s, signer) | ||
func flattenCloudfrontSigners(signers []*cloudfront.Signer) []interface{} { | ||
result := make([]interface{}, 0, len(signers)) |
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.
💯
Indeed! Definitely will call out this one. |
This has been released in version 2.28.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 or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks! |
…lly for now, add test covering existing active_trusted_signers behavior Reference: #8902 Reference: #10013 Reference: #10093 Temporarily keep the existing behavior for the only provider attribute using the legacy package so we can migrate to the standalone Terraform Plugin SDK from the github.com/hashicorp/terraform dependency in the future. Switching this attribute to not use the flatmap package will require state migration or deprecation. Output from acceptance testing: ``` --- PASS: TestAccAWSCloudFrontDistribution_DefaultCacheBehavior_TrustedSigners (1351.69s) ```
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 #8902
Release note for CHANGELOG:
This attribute implemented a legacy Terraform library (
flatmap
), which does not work with Terraform 0.12's data types and whose only usage was on this single attribute. This was missed during the Terraform 0.12 upgrade since there were no covering acceptance tests and the CloudFront setup itself is fairly esoteric (requires root AWS account login to manage CloudFront Keys).The attribute now correctly implements (in the closest approximation) the standard Terraform Provider SDK types and methodology for saved nested object data to the Terraform state. The
items
subattribute list is now accessible again in Terraform 0.12. It does, however, unavoidably switch the rootactive_trusted_signers
attribute toTypeList
instead ofTypeMap
(which does not support map elements of different types in the current Terraform Provider SDK), so any potential references to nested attributes will need to be changed in user configurations, e.g.Previously:
Now:
Output from acceptance testing: