-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Role.addManagedPolicy does not work for imported roles #8307
Copy link
Copy link
Closed
Labels
@aws-cdk/aws-iamRelated to AWS Identity and Access ManagementRelated to AWS Identity and Access ManagementbugThis issue is a bug.This issue is a bug.docs/inlineRelated to inline documentation of the API ReferenceRelated to inline documentation of the API ReferencedocumentationThis is a problem with documentation.This is a problem with documentation.effort/smallSmall work item – less than a day of effortSmall work item – less than a day of effortp2
Metadata
Metadata
Assignees
Labels
@aws-cdk/aws-iamRelated to AWS Identity and Access ManagementRelated to AWS Identity and Access ManagementbugThis issue is a bug.This issue is a bug.docs/inlineRelated to inline documentation of the API ReferenceRelated to inline documentation of the API ReferencedocumentationThis is a problem with documentation.This is a problem with documentation.effort/smallSmall work item – less than a day of effortSmall work item – less than a day of effortp2
Inconsistent Behavior: aws_iam.Role.attachManagedPolicy vs aws_iam.ManagedPolicy.attachToRole
The Scenario
TLDR; aws_iam.Role.attachManagedPolicy does not attach the specified managed policy to the role, aws_iam.ManagedPolicy.attachToRole does.
I have two stacks: one stack deploys roles another deploys an application stack (both are in the same account). The roles stack is deployed first.
In the application stack, I would like to attach a managed policy to a role in the first.
Attempting to use aws_iam.Role.attachManagedPolicy does not create the association but aws_iam.ManagedPolicy.attachToRole does.
Environment
Other information
Steps to reproduce
Observed
Expected