(ecs): FargateService fails on imported Subnets if availability zone attribute is missing #30104
Labels
@aws-cdk/aws-ecs
Related to Amazon Elastic Container
bug
This issue is a bug.
effort/medium
Medium work item – several days of effort
p2
Describe the bug
Creating a new
ecs.FargateService
with specificsubnet-ids
via itsvpcSubnets: ec2.SubnetSelection
property fails even when onlysubnet-id
is required.Due to environment constraints, our AWS CDK Construct must depend on existing CloudFormation Stack Exported Outputs in the AWS Environment.
Sample code:
Work Around:
Expected Behavior
Providing the ecsFargateService an explicit list of SubnetIds should not require the Availability Zone attribute per Subnet ... (the bug is caused by -
L480
:aws-cdk/packages/aws-cdk-lib/aws-ec2/lib/vpc.ts
Lines 474 to 486 in 46168aa
Current Behavior
Error is thrown
Reproduction Steps
Possible Solution
Either:
ecs.BaseService
allows passing in Subnets byISubnet[]
, orvpc.selectSubnets()
should not error if theavailabilityZone
attribute does not exist on the subnet?Additional Information/Context
No response
CDK CLI Version
2.140.0
Framework Version
2.140.0
Node.js Version
20.12.2
OS
WSL
Language
TypeScript
Language Version
5.3.3
Other information
No response
The text was updated successfully, but these errors were encountered: