0
我在使用嵌套堆栈创建堆栈时遇到问题。我有一个主模板(列出的用于测试,并且仅引用一个嵌套堆栈)。我想弄清楚如何将主值传递给嵌套堆栈,还是有更好的方法来做到这一点?每次尝试创建堆栈,我得到一个:AWS cloudformation将值传递给嵌套堆栈
Template format error: Unresolved resource dependencies [VpcCidrBlock] in the Resources block of the template.
我的理解是指我把在主堆栈中的参数不获取传递到嵌套堆栈。
主模板:
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "Master template",
"Parameters" : {
"availabilityZone" : {
"Default" : "us-east-1d",
"Description" : "Enter AvailabilityZone.",
"Type" : "String"
},
"VpcCidrBlock" : {
"Default" : "10.0.0.0/16",
"Description" : "VPC CIDR Block.",
"Type" : "String"
}
},
"Resources" : {
"VPCStack" : {
"Type" : "AWS::CloudFormation::Stack",
"Properties" : {
"TemplateURL" : "https://s3.amazonaws.com/dev.url.templates/templates/vpcStack.json",
"TimeoutInMinutes" : "5",
"Parameters" : {
"VpcCidrBlock" : {
"Ref" : "VpcCidrBlock"
}
}
}
}
}
}
VPC模板:
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "VPC template",
"Resources" : {
"VpcStack" : {
"Type" : "AWS::EC2::VPC",
"Properties" : {
"EnableDnsSupport" : "true",
"EnableDnsHostnames" : "true",
"CidrBlock" : {
"Ref" : "VpcCidrBlock"
},
"Tags" : [
{
"Key" : "Application",
"Value" : {
"Ref" : "AWS::StackName"
}
}
]
}
}
}
}
谢谢!