我想通过以下方式访问值MyVar
:
'!FindInMap [!Ref Stage, !Ref AWS::Region, MyVar]'
Mappings:
stage1:
us-west-2:
MyVar: 15
stage2:
us-west-2:
MyVar: 15
stage3:
eu-west-1:
MyVar: 20
us-east-1:
MyVar: 30
我必须定义映射中不存在的阶段变量(用户名-stage1)。有没有办法可以定义默认值?我想要一个功能,
If matching key1, key2 not found, return MyVar as 0.
最佳答案
遗憾的是,CloudFormation for Mappings
中没有此类功能。您可以为参数
设置默认值,如果这有帮助的话。
关于amazon-web-services - Cloudformation - 在 map 中定义默认值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63255643/