CloudFormation Transform :: Include参数

Daw*_*uba 5 amazon-ec2 aws-cloudformation

我想将AWS宏Transform :: include与一些动态参数一起用于我的文件。

Resources:
  'Fn::Transform':
    Name: 'AWS::Include'
    Parameters:
      TestMacroVariable: 
        Default: 2
        Type: Number
      Location: !Sub "s3://${InstallBucketName}/test.yaml"
Run Code Online (Sandbox Code Playgroud)

test.yaml:

DataAutoScalingGroup:
  Type: AWS::AutoScaling::AutoScalingGroup
  Properties:
    LaunchConfigurationName: 
      Ref: DataLaunchConfiguration
    MinSize: '1'
    MaxSize: '100'
    DesiredCapacity: 
      Ref: TestMacroVariable
...
Run Code Online (Sandbox Code Playgroud)

致电后: aws cloudformation describe-stack-events --stack-name $stack

我得到:

“” ResourceStatusReason“:”转换包含下的参数TestMacroVariable的值必须解析为字符串,数字,布尔值或任何这些的列表。用户请求回滚。


当我尝试这样做时:

Resources:
  'Fn::Transform':
    Name: 'AWS::Include'
    Parameters:
      TestMacroVariable: 2
      Location: !Sub "s3://${InstallBucketName}/test.yaml"
Run Code Online (Sandbox Code Playgroud)

我得到:

“ ResourceStatusReason”:“模板格式错误:模板的Resources块中未解决的资源依赖性[TestMacroVariable]

当我完全不提供TestMacroVariable时,错误是相同的。


尝试过不同的类型:字符串,数字,布尔值,列表-它们都不起作用。

Ntw*_*ike 2

据我所知,除了位置键之外,您不能ParametersAWS::Include. 检查此处AWS 文档