question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(aws_iam): service roles are doubled, causing a fatal error, when using the same role for 2 resources

See original GitHub issue

service roles are doubled, causing a fatal error, when using the same role for 2 resources

I have 2 lambda functions and 2 config rules and as you can see the AWSConfigRulesExecutionRole is attached as a managed policy twice, even though I don’t have it at all in my iam stack: IAM Policy Changes β”Œβ”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ Resource β”‚ Managed Policy ARN β”‚ β”œβ”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ + β”‚ ${EBS Encrypted Lambda Role} β”‚ arn:${AWS::Partition}:iam::aws:policy/IAMReadOnlyAccess β”‚ β”‚ + β”‚ ${EBS Encrypted Lambda Role} β”‚ arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole β”‚ β”‚ + β”‚ ${EBS Encrypted Lambda Role} β”‚ arn:${AWS::Partition}:iam::aws:policy/service-role/AWSConfigRulesExecutionRole β”‚ β”‚ + β”‚ ${EBS Encrypted Lambda Role} β”‚ arn:${AWS::Partition}:iam::aws:policy/service-role/AWSConfigRulesExecutionRole β”‚ β””β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

The stack then errors out: `iam: deploying… iam: creating CloudFormation changeset… [β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–‹Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·Β·] (2/3)

1:40:37 PM | CREATE_FAILED | AWS::IAM::Role | EBS Encryp` Property ManagedPolicyArns contains duplicate values.

Reproduction Steps

create 2 lambda functions and 2 custom config rules, use the same role for each lambda function

If I comment the 2nd config custom rule it works fine

What did you expect to happen?

I didn’t know it would add the service role at all because I don’t explicitly specify it, but it certainly shouldn’t be adding it twice.

What actually happened?

arn:${AWS::Partition}:iam::aws:policy/service-role/AWSConfigRulesExecutionRole was added twice

Environment

  • CDK CLI Version: 1.85.0 (build 5f44668)
  • Framework Version: How do I find this?
  • Node.js Version:15.6.0
  • OS : Mac Big Sur
  • Language (Version): Python 3.8.6

Other

URL to the code: https://github.com/NickTheSecurityDude/config-security-risks


This is πŸ› Bug Report

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
skinny85commented, Jan 27, 2021

I still think this is a bug in the IAM service library πŸ™‚ (the Managed Policy should be attached to the Role only once)

0reactions
github-actions[bot]commented, Jan 27, 2021

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting IAM roles - AWS Documentation - Amazon.com
Diagnose and fix issues that you might encounter when working with IAM roles.
Read more >
Top 5 Common AWS IAM Errors you Need to Fix | A Cloud Guru
1. AccessDeniedException – I Can't Assume a Role ... IAM roles can be used to delegate access to your AWS resources across different...
Read more >
AWS Security Best Practices - Awsstatic
An IAM role lets you define a set of permissions to access the resources that a user or service needs, but the permissions...
Read more >
AWS Nuke without destroying SSO - Medium
The problem is the cost-free resources that are hiding and might cause us problems later on if we try to re-use the account,...
Read more >
Database Engine events and errors - SQL Server
This is a serious error condition which might interfere with ... Correct the cause of this error, and restart the SQL Server service....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found