-
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
(module name): (short issue description) #22773
Comments
|
|
@peterwoodworth thanks, I'll do that -- question is, why was the duplicate policy added, though? |
@JoshMcCullough When passing in a queue to a Lambda Function, the Function will grant permissions to its role send a message to its queue. That's done in our code here: aws-cdk/packages/@aws-cdk/aws-lambda/lib/function.ts Lines 1209 to 1212 in 4c11af6
The role of the function is the role you passed in to the function, so that role is having this policy added to it because that's what this construct does to ensure the role has correct permissions. For people who don't want our constructs to add policies automatically like this, we support the option to pass in a role which cannot have policies added to it. |
Understood. I was suggesting that before adding a role, it would be cleaner and more clear (but perhaps have no functional affect) to first check if a policy with the same (or more) actions already exists for the resource. That'd me we don't have to worry about immutability because if we set up our role correctly beforehand, then we're good, or if we'd rather let CDK manage it, then we'd also be good -- win win, IMO. 👍 |
Describe the bug
Additional
RoleDefaultPolicy5FFB7DAB
added to template during synth.Expected Behavior
Existing role already includes the policy described in
RoleDefaultPolicy5FFB7DAB
, so it shouldn't be included in the template.Current Behavior
No errors, stack deploys okay but template contains extraneous data, maybe?
Reproduction Steps
Stack:
Generated Template:
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.50.0
Framework Version
No response
Node.js Version
18.4.0
OS
Manjaro Linux 22
Language
Typescript
Language Version
4.8.4
Other information
Possibly related to:
The text was updated successfully, but these errors were encountered: