-
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_iam_role Added Tags as an output. #12349
Conversation
aws/data_source_aws_iam_role.go
Outdated
@@ -97,6 +99,10 @@ func dataSourceAwsIAMRoleRead(d *schema.ResourceData, meta interface{}) error { | |||
} | |||
d.Set("unique_id", output.Role.RoleId) | |||
|
|||
if len(output.Role.Tags) > 0 { |
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.
@robh007 Thanks for this.
if len(output.Role.Tags) > 0
shouldn't be necessary here as keyvaluetags.IamKeyValueTags
can handle that case.
@@ -34,6 +34,35 @@ func TestAccAWSDataSourceIAMRole_basic(t *testing.T) { | |||
}) | |||
} | |||
|
|||
func TestAccAWSDataSourceIAMRole_tags(t *testing.T) { |
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.
Could you also test resource.TestCheckResourceAttr(dataSourceName, "tags.%", "0"),
in the TestAccAWSDataSourceIAMRole_basic
case?
Updated as per comments from @ewbankkit. Test output below.
|
Verified acceptance tests: $ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSDataSourceIAMRole_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws/ -v -count 1 -parallel 20 -run=TestAccAWSDataSourceIAMRole_ -timeout 120m
=== RUN TestAccAWSDataSourceIAMRole_basic
=== PAUSE TestAccAWSDataSourceIAMRole_basic
=== RUN TestAccAWSDataSourceIAMRole_tags
=== PAUSE TestAccAWSDataSourceIAMRole_tags
=== CONT TestAccAWSDataSourceIAMRole_basic
=== CONT TestAccAWSDataSourceIAMRole_tags
--- PASS: TestAccAWSDataSourceIAMRole_tags (22.64s)
--- PASS: TestAccAWSDataSourceIAMRole_basic (23.57s)
PASS
ok github.com/terraform-providers/terraform-provider-aws/aws 23.613s |
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.
Looks good, thanks @robh007 🚀
Output from acceptance testing:
--- PASS: TestAccAWSDataSourceIAMRole_basic (11.16s)
--- PASS: TestAccAWSDataSourceIAMRole_tags (11.53s)
This has been released in version 2.54.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! |
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
Relates OR Closes #0000
Release note for CHANGELOG:
Output from acceptance testing: