Tha*_*Guy 6 aws-cloudformation
以下内容在 cloudformation 模板中是否有效:
Parameters:
ParameterA:
Default: ''
NoEcho: false
Type: AWS::SSM::Parameter::Value<List<String>>
Run Code Online (Sandbox Code Playgroud)
因为模板已成功验证,但当我尝试在不提供 ParameterA 的情况下创建堆栈时,cloudformation 返回以下内容:
参数 ParameterA 应该具有输入值或默认值
我想要一个可选的 SSM 参数,因为它由在特定条件下创建的资源使用。
小智 -1
您可以通过以下方式实现您的目标:
Parameters:
ParameterA:
Default: ''
Type: String
Conditions:
toCreateResourceA: !Not [!Equals [!Sub '${ParameterA}', '']]
Resources:
#Use Case 1: Only create resource if ParameterA exists
ResourceA:
Condition: toCreateResourceA
Type: AWS::xx
Properties:
#Use Case 2: Configure value if ParameterA exists
PropertyA: !If [toCreateResourceA, !Sub "{{resolve:ssm:${ParameterA}}}", !Ref AWS::NoValue]
...
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6145 次 |
| 最近记录: |