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

iam/role: If inline fails, role fails #38477

Merged
merged 5 commits into from
Jul 23, 2024
Merged

Conversation

YakDriver
Copy link
Member

@YakDriver YakDriver commented Jul 22, 2024

Description

Relations

Closes #23124

References

Output from Acceptance Testing

% make t T=TestAccIAMRole_InlinePolicy_malformed K=iam
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.5 test ./internal/service/iam/... -v -count 1 -parallel 20 -run='TestAccIAMRole_InlinePolicy_malformed'  -timeout 360m
=== RUN   TestAccIAMRole_InlinePolicy_malformed
=== PAUSE TestAccIAMRole_InlinePolicy_malformed
=== CONT  TestAccIAMRole_InlinePolicy_malformed
--- PASS: TestAccIAMRole_InlinePolicy_malformed (6.70s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/iam	9.241s

@YakDriver YakDriver requested a review from a team as a code owner July 22, 2024 22:13
Copy link

Community Note

Voting for Prioritization

  • Please vote on this pull request by adding a 👍 reaction to the original post to help the community and maintainers prioritize this pull request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@terraform-aws-provider terraform-aws-provider bot added service/iam Issues and PRs that pertain to the iam service. size/XS Managed by automation to categorize the size of a PR. labels Jul 22, 2024
Copy link

Thank you for your contribution! 🚀

A new usage of AWS SDK for Go V1 was detected. Please prefer AWS SDK for Go V2 for all net-new services. If this is an enhancement or bug fix to an existing AWS SDK Go V1 based resource, this comment can be safely ignored.

For additional information refer to the AWS SDK for Go Versions page in the contributor guide.

@terraform-aws-provider terraform-aws-provider bot added tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. size/M Managed by automation to categorize the size of a PR. and removed size/XS Managed by automation to categorize the size of a PR. labels Jul 22, 2024
Steps: []resource.TestStep{
{
Config: testAccRoleConfig_policyInlineMalformed(rName, rName),
ExpectError: regexache.MustCompile(`MalformedPolicyDocument`),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a little tough to test fully because Check doesn't run if an error is encountered. I would like to do a testAccCheckRoleDestroy to make sure it's gone before the destroy phase, but, I verified by tracing execution that the role is deleted in this case.

Copy link
Member

@jar-b jar-b left a 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_
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.5 test ./internal/service/iam/... -v -count 1 -parallel 20 -run='TestAccIAMRole_'  -timeout 360m

--- PASS: TestAccIAMRole_badJSON (4.58s)
=== CONT  TestAccIAMRole_testNameChange
--- PASS: TestAccIAMRole_InlinePolicy_malformed (13.73s)
=== CONT  TestAccIAMRole_namePrefix
--- PASS: TestAccIAMRole_disappears (25.88s)
=== CONT  TestAccIAMRole_nameGenerated
--- PASS: TestAccIAMRole_InlinePolicy_empty (26.11s)
=== CONT  TestAccIAMRole_ManagedPolicy_outOfBandAdditionIgnored
=== CONT  TestAccIAMRole_tags_DefaultTags_updateToResourceOnly
--- PASS: TestAccIAMRole_namePrefix (33.27s)
--- PASS: TestAccIAMRole_InlinePolicy_outOfBandRemovalAddedBack (51.75s)
=== CONT  TestAccIAMRole_basic
--- PASS: TestAccIAMRole_policiesForceDetach (51.84s)
=== CONT  TestAccIAMRole_tags_ComputedTag_OnUpdate_Replace
--- PASS: TestAccIAMRole_ManagedPolicy_outOfBandRemovalAddedBack (51.98s)
=== CONT  TestAccIAMRole_tags_ComputedTag_OnUpdate_Add
--- PASS: TestAccIAMRole_ManagedPolicy_outOfBandAdditionRemovedEmpty (53.29s)
=== CONT  TestAccIAMRole_tags_ComputedTag_OnCreate
--- PASS: TestAccIAMRole_InlinePolicy_outOfBandAdditionRemovedEmpty (53.52s)
=== CONT  TestAccIAMRole_tags_DefaultTags_nullNonOverlappingResourceTag
--- PASS: TestAccIAMRole_InlinePolicy_outOfBandAdditionRemoved (53.85s)
=== CONT  TestAccIAMRole_tags_DefaultTags_nullOverlappingResourceTag
--- PASS: TestAccIAMRole_ManagedPolicy_outOfBandAdditionRemoved (53.96s)
=== CONT  TestAccIAMRole_tags_DefaultTags_emptyProviderOnlyTag
--- PASS: TestAccIAMRole_testNameChange (51.90s)
=== CONT  TestAccIAMRole_tags_DefaultTags_emptyResourceTag
--- PASS: TestAccIAMRole_nameGenerated (35.28s)
=== CONT  TestAccIAMRole_InlinePolicy_outOfBandAdditionIgnored
--- PASS: TestAccIAMRole_InlinePolicy_ignoreOrder (62.74s)
=== CONT  TestAccIAMRole_tags_EmptyTag_OnUpdate_Replace
--- PASS: TestAccIAMRole_maxSessionDuration (69.36s)
=== CONT  TestAccIAMRole_tags_DefaultTags_updateToProviderOnly
--- PASS: TestAccIAMRole_ManagedPolicy_outOfBandAdditionIgnored (47.76s)
=== CONT  TestAccIAMRole_tags_DefaultTags_overlapping
--- PASS: TestAccIAMRole_ManagedPolicy_basic (75.71s)
=== CONT  TestAccIAMRole_tags_DefaultTags_nonOverlapping
--- PASS: TestAccIAMRole_description (79.39s)
=== CONT  TestAccIAMRole_tags_DefaultTags_providerOnly
--- PASS: TestAccIAMRole_InlinePolicy_basic (79.47s)
=== CONT  TestAccIAMRole_tags_EmptyTag_OnCreate
--- PASS: TestAccIAMRole_basic (39.91s)
=== CONT  TestAccIAMRole_tags_EmptyTag_OnUpdate_Add
--- PASS: TestAccIAMRole_tags_ComputedTag_OnCreate (42.65s)
=== CONT  TestAccIAMRole_tags_AddOnUpdate
--- PASS: TestAccIAMRole_tags_DefaultTags_emptyProviderOnlyTag (42.67s)
=== CONT  TestAccIAMRole_tags_null
--- PASS: TestAccIAMRole_tags_DefaultTags_nullOverlappingResourceTag (43.00s)
--- PASS: TestAccIAMRole_tags_DefaultTags_nullNonOverlappingResourceTag (43.62s)
--- PASS: TestAccIAMRole_tags_DefaultTags_emptyResourceTag (42.21s)
--- PASS: TestAccIAMRole_diffsCondition (111.65s)
--- PASS: TestAccIAMRole_tags_DefaultTags_updateToResourceOnly (65.94s)
--- PASS: TestAccIAMRole_InlinePolicy_outOfBandAdditionIgnored (58.22s)
--- PASS: TestAccIAMRole_tags_ComputedTag_OnUpdate_Add (68.56s)
--- PASS: TestAccIAMRole_tags_ComputedTag_OnUpdate_Replace (69.05s)
--- PASS: TestAccIAMRole_tags_EmptyTag_OnUpdate_Replace (60.54s)
--- PASS: TestAccIAMRole_tags_DefaultTags_updateToProviderOnly (58.37s)
--- PASS: TestAccIAMRole_permissionsBoundary (132.13s)
--- PASS: TestAccIAMRole_tags (132.50s)
--- PASS: TestAccIAMRole_tags_null (37.38s)
--- PASS: TestAccIAMRole_tags_EmptyTag_OnCreate (56.34s)
--- PASS: TestAccIAMRole_tags_AddOnUpdate (42.46s)
--- PASS: TestAccIAMRole_tags_DefaultTags_nonOverlapping (70.72s)
--- PASS: TestAccIAMRole_tags_DefaultTags_overlapping (73.70s)
--- PASS: TestAccIAMRole_tags_EmptyTag_OnUpdate_Add (56.78s)
--- PASS: TestAccIAMRole_tags_DefaultTags_providerOnly (78.09s)
--- PASS: TestAccIAMRole_diffs (202.07s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/iam        207.935s

@YakDriver YakDriver merged commit a6fb3af into main Jul 23, 2024
35 checks passed
@YakDriver YakDriver deleted the f-iam-role-inline-fail-role-fail branch July 23, 2024 15:23
@github-actions github-actions bot added this to the v5.60.0 milestone Jul 23, 2024
terraform-aws-provider bot pushed a commit that referenced this pull request Jul 23, 2024
Copy link

This functionality has been released in v5.60.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!

Copy link

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.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
service/iam Issues and PRs that pertain to the iam service. size/M Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IAM Role not added to state when inline IAM Policy is invalid
2 participants