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.

[codepipeline] Issues with default created roles for actions

See original GitHub issue

Reproduction Steps

I have set a role to a pipeline with multiple actions :

    const Codepipeline = new codepipeline.Pipeline(this, 'Codepipeline', {
      role: IamRoleCodepipeline,
      stages: [
        {
          stageName: 'DEV',
          actions: [
            new codepipeline_actions.ManualApprovalAction({
              actionName: 'Deploy-Validation',
              notificationTopic: SnsTopicCodepipeline,
              runOrder: 1
            }),

In that case, CDK create additional roles for each actions (useless because permissions are in the “main” role defined at the beginning). Ok, it’s interesting to give the selected permissions for each actions, a best practice.

But in that case I have an error at this CodePipeline stage when executing it : The provided role cannot be assumed: 'Access denied when attempting to assume the role 'arn:aws:iam::123456789:role/pipeline-ecs-CodepipelineDEVD-1P2J04U72KI7H''

And indeed, in Trusted entities of the “default role” created on our behalf, I have the Account ID where CodePipeline is deployed; and no access for Codepipeline Service !

So, to prevent that, I have to set the prop role: IamRoleCodepipeline, for each actions to get it works.

What did you expect to happen?

If we set/create and attach a role to CodePipeline, no need te create “default” roles on our behalf. That role must have the priority (it’s the case when using/creating via CloudFormation).

Maybe add a prop (boolean) to create a default role on each actions needed if wanted ?

What actually happened?

Actually, I have plenty of role created by default for each actions, useless in my case. I just want to set 1 role for Codepipeline and set some other when, for example, I need to set a Role created on another account to STS on it.

Environment

  • **CLI Version :CDK 1.60.0
  • **Framework Version:6.14.8
  • **Node.js Version:v12.15.0
  • **OS :Linux
  • **Language (Version):*TypeScript *

Other


This is 🐛 Bug Report

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
vandreykivcommented, Dec 28, 2020

Any updates on this issue? In our case we have around 150 pipelines right now and they created like 1500 IAM roles (around 10 per pipeline) that is quite big amount. Maybe we have some workaround to reduce this number?

0reactions
skinny85commented, Dec 28, 2020

Just to clarify: if you’re using that Role just as the Role for a CodeBuild Project Action, you do not need to trust the CodeBuild principal in that Role.

Only the Project’s Role needs to do that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting CodePipeline - AWS Documentation
Problem: The service role for CodePipeline must include the "elasticbeanstalk:DescribeEvents" action for any pipelines that use AWS Elastic Beanstalk. Without ...
Read more >
Cannot assume role by code pipeline on code pipeline action ...
The user that I am using has enough permission to access and use the code pipeline. My problem is, AWS CDK generates a...
Read more >
Create a pipeline in CodePipeline that uses resources from ...
This requires actions from both AccountA and AccountB . Topics. Configure policies and roles in the account that will create the pipeline (AccountA) ......
Read more >
Why I switched from AWS CodePipeline to GitHub Actions
You also need to create a GitHubActionsDeployer IAM role in the target ... With GitHub Actions, failed workflow runs will by default send...
Read more >
Creating an AWS CodePipeline Stack and troubleshooting ...
The first step to achieve this goal is creating the AWS IAM Role the CodeBuild project will have, granting it permissions to perform...
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