aws / aws/aws-cdk

(codepipeline-actions): support cross account CodeStarConnectionsSourceAction connections

Open
#14,355 4 comments 6 reactions 0 assignees View on GitHub
@aws-cdk/aws-codepipeline-actions bug effort/medium p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
1d 19h
Merged PRs (30d)
74

Description

How can I use the CodeStarConnectionsSourceAction to connect to a cross account `arn:aws:codestar-connections` resource?

The other account has the resource `arn:aws:codestar-connections:us-west-2:connection/aEXAMPLE-8aad-4d5d-8878-dfcab0bc441f`. It's all wired up and works.

I tried to create a policy of:

```json
{
"Version": "2012-10-17",
"Statement": {
"Effect": "Allow",
"Action": [
"codestar-connections:UseConnection"
],
"Resource": "arn:aws:codestar-connections:us-west-2:connection/aEXAMPLE-8aad-4d5d-8878-dfcab0bc441f"
}
}
```

And allow the pipeline account to assume that role as a trusted principal.

Then I add:

```ts
const role = new iam.Role.fromARN("Role that allows assuming above policy from cross account", { mutable: false });
const sourceAction = new codepipeline_actions.CodeStarConnectionsSourceAction({
connectionArn: "arn:aws:codestar-connections:us-west-2:connection/aEXAMPLE-8aad-4d5d-8878-dfcab0bc441f",
role: role,
// ...
});
```

Then CodePipeline assumes that role so it can use that codestar connection, but it fails with some missing S3 permissions.

How to resolve?

Contributor guide

Open the contributing guide

Research direction

Start with the CodeStarConnectionsSourceAction configuration shown in the issue and reproduce the cross-account setup, including the assumed role and connection ARN. Trace the generated permissions involved in the missing S3 access; done means the source action can use the cross-account CodeStar connection without the reported S3 permission failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, infrastructure
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.