creating cloudformation stack, which create additional subnet in vpc, i get VPCId (existing VPC) as parameter to stack. How to get VPC cidr inside CF stack
1
votes
1 Answers
4
votes
From AWS::EC2::VPC - AWS CloudFormation:
Fn::GetAtt
returns a value for a specified attribute of this type. The following are the available attributes and sample return values:
CidrBlock
: The set of IP addresses for the VPC. For example, 10.0.0.0/16.
However, I suspect this only works on a VPC that was created within the CloudFormation template.
Since you want to refer to an existing VPC, you will need to write a CloudFormation custom resource using AWS Lambda.
It's a bit tricky, but there are some good sample templates at: stelligent/cloudformation-custom-resources