-
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
Role.addToPolicy does not exist for imported roles #24195
Comments
This is related to #8307 but not duplicated. I am leaving it open as p2 and all upvotes on this issue would help us prioritize. Thank you. |
Generally, reports like this aren't bugs because imported resources are known to have limited functionalities, and we also don't claim to support this method on imported roles in our documentation. From the developer guide:
However, I looked a little bit into this and it looks like the ImportedRole that we return actually does have this method: this is its implementation aws-cdk/packages/@aws-cdk/aws-iam/lib/private/imported-role.ts Lines 41 to 57 in 5862f7a
As you can see, it's just calling |
@peterwoodworth @pahud I have a different interpretation to this it is not supported because fromRoleName returns an IRole interface. This interface does not have a addToPolicy method. That is why we cannot access this method. |
Describe the bug
I am trying to import the role, however just like #8307 addTopolicy does not exist on imported role.
Expected Behavior
addToPolicy should have been working on the import role.
Current Behavior
The method does not exist
Reproduction Steps
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.44.0
Framework Version
No response
Node.js Version
16.17.0
OS
macos
Language
Typescript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: