我在java中使用aws cdk
给定以下使用内在函数的yaml输入!裁判
Parameters:
EnvironmentName:
Description: An environment name that will be prefixed to resource names
Type: String
VpcCIDR:
Description: Please enter the IP range (CIDR notation) for this VPC
Type: String
Default: 10.0.0.0/16
Resources:
VPC:
Type: AWS::EC2::VPC
Properties:
CidrBlock: !Ref VpcCIDR
EnableDnsHostnames: true
Tags:
- Key: Name
Value: !Ref EnvironmentName
使用以下aws cdk代码,c.getcidrblock()返回${token[vpccidr.ref.79]}
如何获得值10.0.0.0/16?
public HelloCdkStack(final Construct scope, final String id, final StackProps props) throws IOException {
super(scope, id, props);
CfnInclude template = CfnInclude.Builder.create(this, "Template")
.templateFile("/home/vmdovs/NetBeansProjects/cf-import/contentTests/KirillosExamples/yaml2/ExampleFullWithSelectTest.yml")
.build();
List<IConstruct> lic = template.getNode().getChildren();
Iterator<IConstruct> itIC = lic.iterator();
while (itIC.hasNext()) {
IConstruct IC = itIC.next();
if (IC instanceof CfnVPC) {
System.out.println("IC is instanceof of CfnVPC");
CfnVPC C = (CfnVPC)IC;
System.out.println("cidr: " + C.getCidrBlock());
}
}
}
谢谢你,康泰
暂无答案!
目前还没有任何答案,快来回答吧!