aws-cdk: [pipelines] Metadata errors should fail synthesis (on stacks deployed in the pipeline)
This issue is similar to https://github.com/aws/aws-cdk/issues/5594 however, occurs without nested stacks. Instead, I have a cross-account CdkPipeline setup according to the minimal example from the documentation. My Stack consists only of a simple VPC.
When deploying, the CloudFormation template in the target account still contains the dummy1a, dummy1b etc. AZs. Finally, these are reported as invalid and my stack is rolled back.
Reproduction Steps
pipeline.addApplicationStage(new MyApplication(this, 'Dev', {
env: {
account: '11111111111',
region: 'eu-west-1',
}
}));
Where MyApplication consist of a single stack with only new VPC(this, 'VPCName')
Error Log
Value (dummy1a) for parameter availabilityZone is invalid. Subnets can currently only be created in the following availability zones: eu-west-1a, eu-west-1b, eu-west-1c. (Service: AmazonEC2; Status Code: 400; Error Code: InvalidParameterValue
Environment
- CLI Version : 1.54.0
- Framework Version: 1.54.0
- Node.js Version: 14.4.0
- OS :
- Language (Version): TypeScript (3.8.3)
Other
This is 🐛 Bug Report
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 36
- Comments: 20 (11 by maintainers)
Commits related to this issue
- fix(core): missing context in Stages is not filled by CLI Missing context in Stages was reported at the inner-assembly level. Since the CLI only inspects the top-level assembly for missing context, i... — committed to aws/aws-cdk by rix0rrr 4 years ago
- fix(core): missing context in Stages is not filled by CLI (#11461) Missing context in Stages was reported at the inner-assembly level. Since the CLI only inspects the top-level assembly for missing... — committed to aws/aws-cdk by rix0rrr 4 years ago
- Add context variables for AZs. See https://github.com/aws/aws-cdk/issues/9226 — committed to michael-dickinson-sainsburys/continuous-audit by michael-dickinson-sainsburys 4 years ago
- Add context variables for AZs. See https://github.com/aws/aws-cdk/issues/9226 — committed to michael-dickinson-sainsburys/continuous-audit by michael-dickinson-sainsburys 4 years ago
- Add context variables for AZs. See https://github.com/aws/aws-cdk/issues/9226 — committed to michael-dickinson-sainsburys/continuous-audit by michael-dickinson-sainsburys 4 years ago
- build: Add context variables for AZs See https://github.com/aws/aws-cdk/issues/9226 — committed to michael-dickinson-sainsburys/continuous-audit by michael-dickinson-sainsburys 4 years ago
- build: Add context variables for AZs See https://github.com/aws/aws-cdk/issues/9226 — committed to michael-dickinson-sainsburys/continuous-audit by michael-dickinson-sainsburys 4 years ago
@moshir Try setting the AZs in your context. You can do this through the context file very easily:
Are there any plans to support lookups like @aws-cdk/aws-ec2.Vpc.fromLookup() in @aws-cdk/pipelines anytime soon?
If you run
cdk deployfrom your local, it should populate thecdk.context.jsonfile with AZ info you can use as a template for additional regions, etc.I changed the title and made it a feature request.
What’s the current/recommended way to create a VPC in a pipeline ?
@njdancer You are right, this is not a workaround but rather an offline solution. An alternative would be to perform this lookup yourself via the AWS SDK, but then you could run into issues with the cross account setup.