![](/img/trans.png)
[英]AWS CloudFormation CodePipeline, ParameterOverrides, pass list to a nested stack
[英]AWS cloudformation pass value to nested stack
我在使用嵌套堆棧創建堆棧時遇到了麻煩。 我有一個主模板(列出的一個用於測試,並且僅引用一個嵌套堆棧)。 我試圖弄清楚如何將值從母版傳遞到嵌套堆棧,還是有更好的方法呢? 每次嘗試創建堆棧時,我都會得到:
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"
}
}
]
}
}
}
}
謝謝!
您的內部模板需要一個輸入參數:
"Parameters" : {
"VpcCidrBlock" : {
"Description" : "VPC CIDR Block.",
"Type" : "String"
}
},
就像您的外部“包裝”模板一樣。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.