-
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
Cannot create IManagedPolicy from a customer managed policy #2974
Comments
From the latest changelog entry:
Is this what you are looking for? |
No, that only allows existing AWS managed policies. Previously you could use any managed policy arn, including manage policies ( |
You can try using addManagedPolicy: const role = new iam.Role(this, 'Role', {
assumedBy: new iam.ServicePrincipal('some.domain')
})
role.addManagedPolicy({
managedPolicyArn: 'managedPolicyArn'
}) |
One of the nice things about
|
I took a stab at implementing the creation / reference of customer managed policies here https://github.com/IainCole/aws-cdk/blob/ic_support_customer_managed_policy/packages/%40aws-cdk/aws-iam/lib/managed-policy.ts It seems to work from my testing, @NGL321 if this makes sense logically I can submit a PR with tests etc. |
I'm submitting a ...
What is the current behavior?
Role.addManagedPolicy(policy: IManagedPolicy)
is the method to add managed policies to a role. However the only method to createIManagedPolicy
isManagedPolicy.fromAwsManagedPolicyName()
, which only supports the AWS managed policies. There is no way to add a customer-managed policy to a role, either by its arn or by a ref to aCfnManagedPolicy
.This is a regression from 0.34.0 behaviour. In 0.34.0 you could do the following:
One or more of the following methods should be added to
ManagedPolicy
to support more managed policy types:To support customer Managed policies.
Please tell us about your environment:
The text was updated successfully, but these errors were encountered: