-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
(scheduler-targets-alpha): Don't add default policy if role is passed to target #30700
Comments
hey @nicklocascio45 ,thanks for reaching out. I am not really sure I understand your issue here. You mentioned that you are creating a role and policies get attached itself ?? It would be helpful if you could please share a complete sample repro code |
Hi @khushail here is the step-by-step of what I'm doing with a simplified version of the code that includes all they key details:
What I'm saying is that my
This additional policy is redundant as I am already allowing the InvokeFunction action on any function with a prefix of When you create a Lambda function, if you don't pass in a role CDK automatically creates a role for you. However, if you do pass in a role, CDK doesn't do any additional policy creation for that role. I'm suggesting that this should behave in the same way. |
Thanks for sharing the repro code @nicklocascio45 . Hereis a mention how CDK automatically grants permissions and how you can opt out of automatic role assignment. Please feel free to let me know if its different that what you are requesting . |
@khushail Ah I apologize I never knew that was an option and totally missed it in the documentation. I believe that is what I'm looking for! Thank you very much, apologies again for the unnecessary issue. |
No problem @nicklocascio45!! Happy to know it was helpful. :) |
|
Comments on closed issues and PRs are hard for our team to see. If you need help, please open a new issue that references this one. |
Describe the feature
When I create an IAM role myself for the LambdaInvoke target, a redundant default policy is automatically attached to the role.
For example, I create a role similar to the following:
I then want to use this role for multiple schedules that are each attached to a function with the same prefix (i.e.
testingfunction1
,testingfunction2
, etc.). Currently, a default policy is automatically created and attached to my role along these lines:Use Case
In order to maintain clean IAM roles without redundancies. If someone is manually creating a role, in my mind that implies that they know what permissions they would like to attach and want to avoid any automated permissions creation. If you just want the construct to take care of role creation for you, then you wouldn't attach a role and everything can continue to function as it is currently.
Proposed Solution
No response
Other Information
No response
Acknowledgements
CDK version used
2.147.1
Environment details (OS name and version, etc.)
Windows Subsystem for Linux (Ubuntu 22.04.4)
The text was updated successfully, but these errors were encountered: