-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Minimized IAM Statements produced are inconsistent #20631
Comments
interesting @joekeilty-oub, thanks for the report. When I try to reproduce this, my template produced by We've been working on reducing our policy sizes #20400 #19764 - I suspect that this is related somehow. cc @rix0rrr |
Likely your problem is that your test doesn't have the feature flag enabled.
Or load it from
|
ahhhhh that'd be it, you're right @polothy. I think the feature flag should be documented in the IAM overview rather than just the PolicyDocument.minimize prop - which personally I think is easy to be overlooked |
Aha, thank you both - I will give that a go! |
Duplicate of #20573, @joekeilty-oub, you're still welcome to give it a go. |
|
@polothy That worked perfectly, thank you! ❤️ |
Describe the bug
aws-cdk version: 2.27.0 (build 8e89048)
aws-cdk-lib version: 2.27.0
I have a Policy attached to a User which has been granted S3 access as such:
When doing
cdk synth
this results in the following statement block being added onto an IAM policy tied to the user:However, when I try to assert that this statement is on the policy in the template it fails because in the template generated by the test it has split it into 2 statements.
Expected Behavior
I expect that the output of
cdk synth
would be the same as whataws_cdk.assertions.Template.from_stack(stack)
produces when it comes to IAM policy statements.Current Behavior
What actually happens is the
aws_cdk.assertions.Template.from_stack(stack)
produces 2 individual statements like so:(pardon the E's, taken straight from my CLI)
Reproduction Steps
Possible Solution
It seems that the
synth
is doing some extra smarts to merge the 2 statements for grant_delete and grant_put_acl into 1 statement?It would be great for the output of synth and aws_cdk.assertions.Template.from_stack() to be as similar as possible so that a developer can write their tests based on the output of synth and what ends up getting deployed into CF
Additional Information/Context
No response
CDK CLI Version
2.27.0 (build 8e89048)
Framework Version
No response
Node.js Version
v18.0.0
OS
Mac
Language
Python
Language Version
3.8.5
Other information
No response
The text was updated successfully, but these errors were encountered: