簡體   English   中英

雲形成模板在 dynamodb 提供中使用 If 條件提供兩個 GSI NonKeyAttributes

[英]cloud formation template using If condition provision two GSI NonKeyAttributes in dynamodb provision

我想使用 if 條件根據參數類型為 dynamodb GSI Non keyattributes 提供兩個值。 以下是我嘗試過但沒有奏效的方法。 我想根據 if 條件添加兩個屬性(att1,att2)

Parameters:  
Apptype:  
string  
Conditions:  
  CIsFinanacial:  
    !Equals [ !Ref Apptype, 'financial' ]

Projection:   
 NonKeyAttributes:   
    !If CIsFinanacial [!Join [","["att1", "att2"], !Ref AWS::Novalue]

上面的 if 條件結果為字符串 (att1,att2) 但我希望它們作為字符串列表提供。 現在作為一種解決方法,我寫了兩個條件和兩個 if 條件。 但是有沒有辦法在一個 if 條件下提供它們。

對不起,寫得不好。

我認為下面的表格應該可以工作(你在 NoValue 中也有拼寫錯誤):

Projection:   
 NonKeyAttributes:   
    !If CIsFinanacial [["att1", "att2"], !Ref AWS::NoValue]

如果沒有,那么你可以更明確:

Projection:   
 NonKeyAttributes:   
    !If 
      - CIsFinanacial 
      - - "att1"
        - "att2"
      - !Ref AWS::NoValue

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM