Skip to content
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

iam: policy names attached to imported resources conflict with each other #7483

Closed
amwill04 opened this issue Apr 21, 2020 · 4 comments
Closed
Labels
@aws-cdk/aws-iam Related to AWS Identity and Access Management bug This issue is a bug. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. effort/small Small work item – less than a day of effort p2

Comments

@amwill04
Copy link

Unable to change to a dynamic policy name when using grantXXX() api.

Given the following within a stack:

const queue = new Queue(this, 'ICEQuoteQueue', {
    queueName: `a-queue-${this.props.environment}`,
    deliveryDelay: Duration.seconds(0),
    visibilityTimeout: Duration.seconds(30),
    retentionPeriod: Duration.days(4),
    receiveMessageWaitTime: Duration.seconds(0),
});
const group = Group.fromGroupArn(
    this,
    'Group',
    this.formatArn({ resource: 'group', service: 'iam', resourceName: 'Name' })
);

queue.grantSendMessages(group)

if I am to create multiple templates the above will create the same policy name meaning that anthing on the same account will override the policy statement.

Therefore if i deploy dev followed by test I will lose the send permissions in dev

Environment

  • **CLI Version :1.33.1
  • **Framework Version:1.33.1
  • **OS :macos
  • **Language :typescript
@amwill04 amwill04 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Apr 21, 2020
@SomayaB SomayaB added the @aws-cdk/aws-iam Related to AWS Identity and Access Management label Apr 22, 2020
@rix0rrr rix0rrr changed the title Changing policyName when using grant iam: policy names attached to imported resources conflict with each other Apr 22, 2020
@rix0rrr rix0rrr added the p2 label Apr 22, 2020
@SomayaB SomayaB removed the needs-triage This issue or PR still needs to be triaged. label May 19, 2020
@rix0rrr
Copy link
Contributor

rix0rrr commented Aug 12, 2020

This is probably not solveable in general, but maybe we can make it slightly less likely to collide by adding in the stack name or something.

@rix0rrr rix0rrr added the effort/small Small work item – less than a day of effort label Aug 12, 2020
@rix0rrr rix0rrr removed their assignment Jun 3, 2021
@acere
Copy link

acere commented Feb 22, 2022

Encountered the same issue when granting privileges to the same IAM roles from two different stacks.
Is there any update on workarounds to rename the IAM policies created by grant* methods?

@github-actions
Copy link

This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added closing-soon This issue will automatically close in 4 days unless further comments are made. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Feb 22, 2023
@thomaswr
Copy link

thomaswr commented Jul 3, 2024

Having the same issue with granting permissions to imported IAM users in two different stacks.
My current workaround is to include the stack name in the id of the imported user.
But very easy to miss that.

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. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. effort/small Small work item – less than a day of effort p2
Projects
None yet
Development

No branches or pull requests

5 participants