-
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
(aws_iam): ManagedPolicy.attachToRole should prevent adding to same role multiple times #28101
Labels
@aws-cdk/aws-iam
Related to AWS Identity and Access Management
bug
This issue is a bug.
effort/small
Small work item – less than a day of effort
p2
Comments
Rouby
added
bug
This issue is a bug.
needs-triage
This issue or PR still needs to be triaged.
labels
Nov 22, 2023
github-actions
bot
added
the
@aws-cdk/aws-iam
Related to AWS Identity and Access Management
label
Nov 22, 2023
Yes we should improve that. I'm making it a p2 and any pull requests are appreciated. |
pahud
added
p2
effort/small
Small work item – less than a day of effort
and removed
needs-triage
This issue or PR still needs to be triaged.
labels
Nov 22, 2023
vinayak-kukreja
added a commit
to lpizzinidev/aws-cdk
that referenced
this issue
Dec 4, 2023
mergify bot
pushed a commit
that referenced
this issue
Dec 5, 2023
#28129) Fixes `attachToUser`, `attachToRole`, and `attachToGroup` for `Policy` and `ManagedPolicy` to use ARNs as a discriminant for resource equality to prevent duplicates on imported resources. Closes #28101. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
chenjane-dev
pushed a commit
to chenjane-dev/aws-cdk
that referenced
this issue
Dec 5, 2023
aws#28129) Fixes `attachToUser`, `attachToRole`, and `attachToGroup` for `Policy` and `ManagedPolicy` to use ARNs as a discriminant for resource equality to prevent duplicates on imported resources. Closes aws#28101. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
@aws-cdk/aws-iam
Related to AWS Identity and Access Management
bug
This issue is a bug.
effort/small
Small work item – less than a day of effort
p2
Describe the bug
Currently
attachToRole
checks for object equality.aws-cdk/packages/aws-cdk-lib/aws-iam/lib/managed-policy.ts
Line 293 in 70f66c7
This does not work if a Role is imported e.g. via
aws_iam.Role.fromRoleArn
as these are unique objects.Expected Behavior
attachToRole
should skip if a role is already added to the list, so that noRoles: array items are not unique
is encounted on deployments.Current Behavior
attachToRole
adds the same role (different objects) twice, which results in a validation error.Reproduction Steps
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.102.0
Framework Version
No response
Node.js Version
18
OS
Mac
Language
TypeScript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: