-
Notifications
You must be signed in to change notification settings - Fork 9k
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
d/aws_nat_gateway: Fix filtering and reading of tags #6231
d/aws_nat_gateway: Fix filtering and reading of tags #6231
Conversation
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 with one non-blocking comment. Thanks @flosell! 🚀
--- PASS: TestAccDataSourceAwsNatGateway (173.96s)
@@ -116,6 +122,7 @@ func dataSourceAwsNatGatewayRead(d *schema.ResourceData, meta interface{}) error | |||
d.Set("state", ngw.State) | |||
d.Set("subnet_id", ngw.SubnetId) | |||
d.Set("vpc_id", ngw.VpcId) | |||
d.Set("tags", tagsToMap(ngw.Tags)) |
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.
When using d.Set()
with aggregate types (TypeList, TypeSet, TypeMap), we should perform error checking to prevent issues where the code is not properly able to set the Terraform state. e.g.
if err := d.Set("tags", tagstoMap(ngw.Tags)); err != nil {
return fmt.Errorf("error setting tags: %s", err)
}
Since the tagsToMap()
function has well established usage across other resources I won't treat this as a blocker here though. 👍
This has been released in version 1.42.0 of the 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! |
Currently,
tags
can be defined as an argument for theaws_nat_gateway
data source and are documented this way but are silently ignored when searching for the NAT Gateway. When reading NAT Gateway details, tag-values aren't populated in terraform. This PR attempts to fix this.Changes proposed in this pull request:
Output from acceptance testing: