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

Fix references to AWS managed policies in SAM templates #6148

Merged
merged 1 commit into from May 25, 2022

Conversation

dominikschubert
Copy link
Member

Fixes the initial problem encountered in #6143 which turned out to be a bit of a rabbit hole.

The SAM translator now properly loads a map of all managed policies (Name => ARN) since cloudformation expects full policy ARNs while SAM allows specifying only the policy name. I've introduced a SAM template & a corresponding test to validate this.

@whummer Note this also reverts the changes introduced in cedc908 since they were breaking parity with AWS (e.g. in iam_client.list_policies calls that would always return aws-us-gov ARNs besides regular ones which broke loading policies via the samtranslator). There were no tests introduced in the linked commit so I'm not sure if this is breaking something. Technically the partition rewriter should take care of this for users in aws-us-gov anyway.

@dominikschubert dominikschubert added aws:cloudformation AWS CloudFormation aws:iam AWS Identity and Access Management area: integration/sam AWS Serverless Application Model labels May 25, 2022
@dominikschubert dominikschubert self-assigned this May 25, 2022
@dominikschubert dominikschubert temporarily deployed to localstack-ext-tests May 25, 2022 20:51 Inactive
Copy link
Member

@whummer whummer left a comment

Choose a reason for hiding this comment

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

Nice set of changes @dominikschubert ! 💯 Great to see that old SAM / us-gov workaround code removed! Can imagine that this must have been quite a rabbit hole.. ;)

@github-actions
Copy link

LocalStack integration with Pro

       3 files  ±0         3 suites  ±0   1h 7m 28s ⏱️ + 2m 42s
1 058 tests +1  1 025 ✔️ +1  33 💤 ±0  0 ±0 
1 354 runs  +1  1 294 ✔️ +1  60 💤 ±0  0 ±0 

Results for commit f1de29d. ± Comparison against base commit faf5d42.

@dominikschubert dominikschubert merged commit 2a56439 into master May 25, 2022
@dominikschubert dominikschubert deleted the fix_sam-managed-policies branch May 25, 2022 22:12
@github-actions github-actions bot locked and limited conversation to collaborators May 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: integration/sam AWS Serverless Application Model aws:cloudformation AWS CloudFormation aws:iam AWS Identity and Access Management
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants