aws / aws/aws-cdk

(codepipeline_actions): CodeDeployEcsDeployAction doesn't return the role created by default

Open
#18,648 13 comments 0 reactions 0 assignees View on GitHub
@aws-cdk/aws-codepipeline-actions documentation effort/small feature-request p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
1d 19h
Merged PRs (30d)
74

Description

### What is the problem?

If you create a CodeDeployEcsDeployAction and don't pass a role as a parameter, the codepipeline will generate a default one for you (as seen in [pipeline.ts](https://github.com/aws/aws-cdk/blob/7966f8d48c4bff26beb22856d289f9d0c7e7081d/packages/%40aws-cdk/aws-codepipeline/lib/pipeline.ts#L573)). However this role cannot be retrieved from the CodeDeployEcsDeployAction object.

### Reproduction Steps

```ts
const deploymentGroup = codedeploy.EcsDeploymentGroup.fromEcsDeploymentGroupAttributes(stack, "DeploymentGroup", {
application: EcsApplication.fromEcsApplicationName(stack, "ECSApplication", "test"),
deploymentGroupName: "test",
});

const action = new codepipeline_actions.CodeDeployEcsDeployAction({
actionName: "Deploy",
deploymentGroup: deploymentGroup,
taskDefinitionTemplateInput: new codepipeline.Artifact("dummy"),
appSpecTemplateInput: new codepipeline.Artifact("dummy2"),
});

const pipeline = new codepipeline.Pipeline(stack, "Pipeline", {
stages: [
{
stageName: "DeployECS",
actions: [action],
},
],
});

const actionRole = action.actionProperties.role;
// actionRole is always undefined
console.log(actionRole);
```

### What did you expect to happen?

`action.actionProperties.role` returns the default role created by codepipeline.

### What actually happened?

`action.actionProperties.role` is undefined.

### CDK CLI Version

1.129.0

### Framework Version

_No response_

### Node.js Version

14.18.1

### OS

Amazon Linux 2

### Language

Typescript

### Language Version

_No response_

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the linked pipeline.ts code and the CodeDeployEcsDeployAction entry point, then trace how action.actionProperties.role is populated when no role is supplied. Reproduce the example and confirm that the generated default role is exposed through action.actionProperties.role.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.