-
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
Add role_last_used attribute to iam_role resource #30750
Conversation
Community NoteVoting for Prioritization
For Submitters
|
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.
Welcome @dpowley 👋
It looks like this is your first Pull Request submission to the Terraform AWS Provider! If you haven’t already done so please make sure you have checked out our CONTRIBUTOR guide and FAQ to make sure your contribution is adhering to best practice and has all the necessary elements in place for a successful approval.
Also take a look at our FAQ which details how we prioritize Pull Requests for inclusion.
Thanks again, and welcome to the community! 😃
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 🎉
$ make testacc PKG=iam TESTS=TestAccIAMRole_
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/iam/... -v -count 1 -parallel 20 -run='TestAccIAMRole_' -timeout 180m
--- PASS: TestAccIAMRole_badJSON (3.87s)
=== CONT TestAccIAMRole_nameGenerated
--- PASS: TestAccIAMRole_InlinePolicy_empty (27.04s) === CONT TestAccIAMRole_namePrefix --- PASS: TestAccIAMRole_basic (29.32s)
=== CONT TestAccIAMRole_InlinePolicy_ignoreOrder
--- PASS: TestAccIAMRole_policiesForceDetach (29.95s)
=== CONT TestAccIAMRole_disappears
--- PASS: TestAccIAMRole_nameGenerated (28.46s)
=== CONT TestAccIAMRole_description
--- PASS: TestAccIAMRole_ManagedPolicy_outOfBandAdditionIgnored (46.91s)
--- PASS: TestAccIAMRole_ManagedPolicy_outOfBandRemovalAddedBack (47.87s)
--- PASS: TestAccIAMRole_ManagedPolicy_outOfBandAdditionRemoved (48.13s)
--- PASS: TestAccIAMRole_InlinePolicy_outOfBandAdditionRemovedEmpty (48.39s)
--- PASS: TestAccIAMRole_ManagedPolicy_outOfBandAdditionRemovedEmpty (48.41s)
--- PASS: TestAccIAMRole_InlinePolicy_outOfBandAdditionRemoved (49.22s)
--- PASS: TestAccIAMRole_InlinePolicy_outOfBandRemovalAddedBack (49.66s)
--- PASS: TestAccIAMRole_testNameChange (50.88s)
--- PASS: TestAccIAMRole_tags (51.32s)
--- PASS: TestAccIAMRole_disappears (22.75s)
--- PASS: TestAccIAMRole_namePrefix (27.63s)
--- PASS: TestAccIAMRole_maxSessionDuration (55.11s)
--- PASS: TestAccIAMRole_InlinePolicy_outOfBandAdditionIgnored (57.35s)
--- PASS: TestAccIAMRole_InlinePolicy_basic (62.27s)
--- PASS: TestAccIAMRole_ManagedPolicy_basic (62.31s)
--- PASS: TestAccIAMRole_InlinePolicy_ignoreOrder (40.83s)
--- PASS: TestAccIAMRole_description (42.03s)
--- PASS: TestAccIAMRole_permissionsBoundary (77.28s)
--- PASS: TestAccIAMRole_diffsCondition (79.48s)
--- PASS: TestAccIAMRole_diffs (186.46s)
PASS
ok github.com/hashicorp/terraform-provider-aws/internal/service/iam 189.688s
$ make testacc PKG=iam TESTS=TestAccIAMRoleDataSource_
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/iam/... -v -count 1 -parallel 20 -run='TestAccIAMRoleDataSource_' -timeout 180m
--- PASS: TestAccIAMRoleDataSource_tags (10.56s)
--- PASS: TestAccIAMRoleDataSource_basic (10.57s)
PASS
ok github.com/hashicorp/terraform-provider-aws/internal/service/iam 13.687s
Thanks for your contribution, @dpowley! |
This functionality has been released in v4.64.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. Thank you! |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Description
This PR adds the
role_last_used
attribute to theaws_iam_role
resource and datasource.Relations
No issue that I could find relating to this.
References
https://docs.aws.amazon.com/IAM/latest/APIReference/API_RoleLastUsed.html
Output from Acceptance Testing
This one is tough to add an acceptance test for because in order to have that value populated, you would need to create a role and then use it and then wait for AWS to populate the last used information (which takes about 15-30 min from what I've seen).
I did run the test locally for both the role and datasource and got the following on create:
Then got the following for the datasource (before using the role):
I then used the role, waited a while and got the following when re-applying:
The updated state for the resource:
The updated state for the datasource: