-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[pipelines] Metadata errors should fail synthesis (on stacks deployed in the pipeline) #9226
Comments
Pipelines does not currently support lookups. (From the blog) Developer preview limitations No context queries – Context queries are not supported. That means that Vpc.fromLookup() and other functions like it don’t work. |
Thanks for the pointer. Do you propose to close this issue as this is a know limitation? |
I changed the title and made it a feature request. |
@J11522 I might be missing something. Does that page outline a workaround or just additional info around context and how to get the available AZ's out of band. The only way I seem to be able to workaround this is by overriding the availabilityZones member inside my Stack subclass. |
@njdancer You are right, this is not a workaround but rather an offline solution. |
What's the current/recommended way to create a VPC in a pipeline ? |
This does not seem to work, even when i override the Stack class TheStack(core.Stack):
def availability_zones(self) -> typing.List[str]:
return ['eu-west-1a', 'eu-west-1b']
def __init__(self, scope, id, **kwargs):
super().__init__(
scope,
id,
**kwargs
)
vpc = ec2.Vpc(self, "VPC",
max_azs=2,
cidr="172.31.0.0/16",
subnet_configuration=[ec2.SubnetConfiguration(
subnet_type=ec2.SubnetType.PUBLIC,
name="Public",
cidr_mask=20
), ec2.SubnetConfiguration(
subnet_type=ec2.SubnetType.PRIVATE,
name="Private",
cidr_mask=24
)
],
nat_gateways=1,
) The output stack will still have dummy1a in the subnet AvailabilityZone: "VPCPublicSubnet1SubnetB4246D30": {
"Type": "AWS::EC2::Subnet",
"Properties": {
"CidrBlock": "172.31.0.0/20",
"VpcId": {
"Ref": "VPCB9E5F0B4"
},
"AvailabilityZone": "dummy1a", |
@moshir Try setting the AZs in your context.
|
There needs to be more clarity around how How did you figure out what to add to that file? @J11522 |
@arpowers To be honest, I can't recall how I figured this out. I guess looking at code and documentation helped in the end. |
If you run |
Are there any plans to support lookups like @aws-cdk/aws-ec2.Vpc.fromLookup() in @aws-cdk/pipelines anytime soon? |
Thanks @J11522 for the tip, adding that totally worked for me! https://github.com/SoManyHs/cdkpipelines-demo/blob/main/cdk.json#L8-L11 |
Missing context in Stages was reported at the inner-assembly level. Since the CLI only inspects the top-level assembly for missing context, it would never detect this and not query for it. Propagate the missing context up to the top-level assembly. Fixes #9226.
Missing context in Stages was reported at the inner-assembly level. Since the CLI only inspects the top-level assembly for missing context, it would never detect this and not query for it. Propagate the missing context up to the top-level assembly. Fixes #9226. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
|
What's happening is something has failed during synthesis, but the synthesis CodeBuild step is not failing and that's why you're seeing dummy AZs in your template |
For example, if I run
The mistake here is that this error is not failing the Pipelines synthesis, which it probably should. The error itself is due to some kind of misconfiguration. |
This will allow you to override the default availability zones.
|
Should probably be an extension to the |
|
This issue is similar to #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
Where MyApplication consist of a single stack with only
new VPC(this, 'VPCName')
Error Log
Environment
Other
This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: