-
Notifications
You must be signed in to change notification settings - Fork 4.5k
(ec2): Passing PhysicalName.GENERATE_IF_NEEDED to a VPC results in an error #18912
Copy link
Copy link
Closed
Labels
@aws-cdk/aws-ec2Related to Amazon Elastic Compute CloudRelated to Amazon Elastic Compute CloudbugThis issue is a bug.This issue is a bug.needs-triageThis issue or PR still needs to be triaged.This issue or PR still needs to be triaged.
Description
What is the problem?
If PhysicalName.GENERATE_IF_NEEDED is passed to the Vpc constructor in vpc_name, it fails to synth.
Reproduction Steps
import aws_cdk as cdk
from aws_cdk import aws_ec2 as ec2
class MyVPC(cdk.Stack):
def __init__(self, scope, id, **kwargs):
super().__init__(scope, id, **kwargs)
ec2.Vpc(self, "vpc", vpc_name=cdk.PhysicalName.GENERATE_IF_NEEDED)
app = cdk.App()
MyVPC(app, "MyVPC")
app.synth()
What did you expect to happen?
Successful synth.
What actually happened?
jsii.errors.JSIIError: Resolution error: Resolution error: Resolution error: Invalid physical name passed to CloudFormation. Use "this.physicalName" instead...
CDK CLI Version
2.12.0
Framework Version
2.10.0
Node.js Version
17.3.0
OS
ArchLinux
Language
Python
Language Version
Python 3.9.10
Other information
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
@aws-cdk/aws-ec2Related to Amazon Elastic Compute CloudRelated to Amazon Elastic Compute CloudbugThis issue is a bug.This issue is a bug.needs-triageThis issue or PR still needs to be triaged.This issue or PR still needs to be triaged.