2017-04-12 17 views
0

ネストされたスタックを使用してスタックを作成する際に問題があります。私は1つのマスタテンプレートを持っています(リストされたものはテストのためのもので、1つのネストされたスタックを参照しています)。私はマスターからネストされたスタックに値を渡す方法を理解しようとしていますか?これを行うには良い方法がありますか?たびにスタックを作成しようと、私が手:私は理解して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" 
         } 
        } 
       ] 
      } 
     } 
    } 
} 

ありがとう!

答えて

0

あなたの内部のテンプレートは、入力パラメータを必要とします。ちょうどあなたの外側の「ラッパー」テンプレートのような

"Parameters" : { 
    "VpcCidrBlock" : { 
     "Description" : "VPC CIDR Block.", 
     "Type" : "String" 
    } 
}, 

関連する問題