【发布时间】:2019-05-30 04:33:16
【问题描述】:
我想为我的文件使用带有一些动态参数的 AWS 宏 Transform::Include。
Resources:
'Fn::Transform':
Name: 'AWS::Include'
Parameters:
TestMacroVariable:
Default: 2
Type: Number
Location: !Sub "s3://${InstallBucketName}/test.yaml"
test.yaml:
DataAutoScalingGroup:
Type: AWS::AutoScaling::AutoScalingGroup
Properties:
LaunchConfigurationName:
Ref: DataLaunchConfiguration
MinSize: '1'
MaxSize: '100'
DesiredCapacity:
Ref: TestMacroVariable
...
致电后:aws cloudformation describe-stack-events --stack-name $stack
我明白了:
"ResourceStatusReason": "参数TestMacroVariable的值 在转换下 Include 必须解析为字符串、数字、布尔值或 这些列表中的任何一个.. 用户请求回滚。”
当我尝试这样做时:
Resources:
'Fn::Transform':
Name: 'AWS::Include'
Parameters:
TestMacroVariable: 2
Location: !Sub "s3://${InstallBucketName}/test.yaml"
我明白了:
"ResourceStatusReason": "模板格式错误:未解析的资源 资源块中的依赖项 [TestMacroVariable] 模板”
当我根本不提供 TestMacroVariable 时,错误也是一样的。
尝试了不同的类型:字符串、数字、布尔值、列表 - 它们都不起作用。
【问题讨论】:
标签: amazon-ec2 amazon-cloudformation