(pipelines): pipeline with action to deploy stack with pipeline with cross region support generates invalid cross region stack
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the bug
We have a CDK application deploys a pipeline (call it A) into an account (000000000000) in eu-central-1 which in turn deploys another pipeline in a tenant account (111111111111) in the same region. The pipeline (call it T) in the tenant account has a cross region deployment and requires a cross region support stack. Because of that the application A should also deploy a cross region support stack to deploy the cross region support stack for the tenant account.
After running npx cdk synth you can see the problem. Open the file cdk.out/cross-region-stack-000000000000:us-east-1.template.json. The KMS Key policy and the bucket resource policy reference roles in eu-central-1 instead of us-east-1. This results in permissions error during deployment.
### Regression Issue
- [ ] Select this option if this issue appears to be a regression.
### Last Known Working CDK Version
_No response_
### Expected Behavior
Generate the cross region support stack the references cdk roles corresponding to the region. The action to deploy the support stack should als reference the correct roles.
### Current Behavior
It generates a cross region support stack that references the region of the pipeline itself. The action to deploy the support stack references the roles corresponding to the region of the pipeline itself..
### Reproduction Steps
I have created a minimal CDK application to reproduce the error.
See https://github.com/rehos/aws-cdk-pipelines-cross-region-issue
### Possible Solution
Cross region stacks should only reference CDK roles for the target region
### Additional Information/Context
_No response_
### CDK CLI Version
2.1000.2
### Framework Version
_No response_
### Node.js Version
22.14.0
### OS
macOS 15.3.1
### Language
TypeScript
### Language Version
Typescript (5.6.3)
### Other information
At the moment we use escape hatches to fix the roles referenced in the action in the pipeline and add the correct role to the key policy and bucket policy
Contributor guide
Research direction
Start by running npx cdk synth in the minimal reproduction repository and inspect cdk.out/cross-region-stack-000000000000:us-east-1.template.json. Compare the KMS key policy, bucket resource policy, and support-stack deployment action with the target region. Done means the generated support stack and action reference CDK roles for the target region without escape hatches.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud, devops, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100