2016-10-19 15 views
1

私はラムダ関数を基にしたカスタムリソースを使用するcloudformationテンプレートを持っています。ラムダ関数のパラメータの1つは文字列のリストです。私はリストに1つのアイテムしか渡しておらず、Fn:Joinを使用して文字列を作成します。ただし、Fn :: Joinを使用すると、無効なjsonが発生するため、エラーが発生します。どんな入力も感謝しています。aws cloudformation使用リストでFn :: Join

"サブスクリプション":[ "のFn ::参加":[ ":"、[ "A"、 "B"、 "C"]]]

A client error (ValidationError) occurred when calling the CreateStack operation : Template format error: JSON not well-formed.

Cloudformationスニペット: -

Subscriptionsプロパティの値を構築するために使用
"Resources": { 
"MyCustomRes": { 
     "Type": "Custom::CustomResource", 
     "Properties": { 
     "ServiceToken": { "Fn::Join": [ "", [ 
             "arn:aws:lambda:", 
             { "Ref": "AWS::Region" }, 
             ":", 
             { "Ref": "AWS::AccountId" }, 
             ":function:LambdaFn" 
             ] ] }, 
     "Version": 1, 
     "ResourceName": { "Ref": "ResourceName" }, 
     "Subscriptions"  : [ "Fn::Join": [ "", [ 
             "arn:aws:sns:", 
             { "Ref": "AWS::Region" }, 
             ":", 
             { "Ref": "AWS::AccountId" }, 
             ":Topic1" 
             ] ] ] 
    } 
}  }, 

答えて

3

Fn::JoinIntrinsic Functionはオブジェクトではなく配列する必要があります。

ではなく、それは{"Fn::Join" : [...]}

ドキュメントはそのため、あなたの雲の形成テンプレートは、次の

を使用する必要があります

{ "Fn::Join" : [ "delimiter", [ comma-delimited list of values ] ] } 

ような構文を記述形式でなければなりません。['Fn::Join' : [...]]ような配列を使用するために、無効なJSONの構文です

"Subscriptions": { 
     "Fn::Join": [":", [ 
      "arn:aws:sns", 
      { "Ref": "AWS::Region"}, 
      { "Ref": "AWS::AccountId"}, 
      "Topic1"] 
     ] 
    } 
関連する問題