Skip to content

Unable to use deploy-time parameters for privateSubnetIds for Vpc.fromVpcAttributes #4118

@amwill04

Description

@amwill04

Unable to pass CommaDelimitedList CfnParameter to VPC.fromVpcAttributes privateSubnetIds

Reproduction Steps

When trying to use existing VPC for a lambda function

const vpcSubnetId = new CfnParameter(this, 'VPCSubnetId', {
            description: 'VPC Subnet Id',
            type: 'CommaDelimitedList',
});
const vpc = Vpc.fromVpcAttributes(this, 'GeoVPC', {
       vpcId: vpcId.valueAsString,
       availabilityZones: ['eu-west-2a', 'eu-west-2b', 'eu-west-2c'],
       privateSubnetIds: vpcSubnetId.valueAsList,
});

When runing npn run build npx synth for a stack with the above in it it will declare the following error:

Number of privateSubnetIds (1) must be a multiple of availability zones (3).

Environment

  • **CLI Version :**1.8.0
  • **Framework Version:**1.8.0
  • **OS :**MacOs 10.14.6
  • **Language :**typescript

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-ec2Related to Amazon Elastic Compute CloudbugThis issue is a bug.effort/mediumMedium work item – several days of effortp2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions