pulumi / pulumi-awsx

AWS infrastructure best practices in component form!
https://www.pulumi.com/docs/guides/crosswalk/aws/
Apache License 2.0
227 stars 104 forks source link

VPC should filter out Local Zones & Wavelength Zones when fetching the list of AZs #1365

Open flostadler opened 2 months ago

flostadler commented 2 months ago

Hello!

Issue details

When the users do not provide the AZs to use for the VPC, the component retrieves the available AZs from AWS: https://github.com/pulumi/pulumi-awsx/blob/01d90b4caeae96dc95449fffc59dce7a3b53d685/awsx/ec2/vpc.ts#L513

This takes into account all availability zones - including local zones or wavelength zones - the user opted into for their account. Those special zones do not support all features (e.g. NAT gateways) meaning the VPC most certainly fails deploying and is in a broken state.

To prevent this from happening we should only take regular AZs into account. This can be done like so:

aws.getAvailabilityZones({
    filters: [{
        name: "opt-in-status",
        values: ["opt-in-not-required"],
    }],
});

Affected area/feature