feat: add inline policy document support to IAM role creation#39
Merged
Conversation
CreateIAMRole now accepts InlinePolicies []InlinePolicy and calls PutRolePolicy for each entry after attaching managed policies. DeleteIAMRole now lists and deletes all inline policies before detaching managed policies and deleting the role, as AWS requires a role to have no policies attached before deletion. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
InlinePolicytype withNameandDocument(JSON) fields toinputs.goInlinePolicies []InlinePolicytoCreateIAMRoleInput— callers can now supply both managed policy ARNs and inline policy documents in a single activity callCreateIAMRolecallsPutRolePolicyfor each inline policy after attaching managed policiesDeleteIAMRolenow callsListRolePolicies+DeleteRolePolicyto remove all inline policies before proceeding to managed policy detachment and role deletion (AWS requires a role to have no policies before it can be deleted)Existing callers that don't set
InlinePoliciesare unaffected.Test plan
go build ./...passesCreateIAMRolewith oneInlinePoliciesentry — inline policy appears on the role in the AWS consoleDeleteIAMRoleon a role with both managed and inline policies — all cleaned up, role deleted without errorSpinUpIAMWorkflow(no inline policies) continues to work unchanged🤖 Generated with Claude Code