gpt4 book ai didi

amazon-ec2 - CloudFormation Transform::包含参数

转载 作者:行者123 更新时间:2023-12-04 21:30:21 24 4
gpt4 key购买 nike

我想使用 AWS 宏 Transform::Include 以及我的文件的一些动态参数。

Resources:
'Fn::Transform':
Name: 'AWS::Include'
Parameters:
TestMacroVariable:
Default: 2
Type: Number
Location: !Sub "s3://${InstallBucketName}/test.yaml"

测试.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": "The value of parameter TestMacroVariable under transform Include must resolve to a string, number, boolean or a list of any of these.. Rollback requested by user."


当我尝试这样做时:

Resources:
'Fn::Transform':
Name: 'AWS::Include'
Parameters:
TestMacroVariable: 2
Location: !Sub "s3://${InstallBucketName}/test.yaml"

我得到:

"ResourceStatusReason": "Template format error: Unresolved resource dependencies [TestMacroVariable] in the Resources block of the template"

当我根本不提供 TestMacroVariable 时,错误是相同的。


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

最佳答案

据我所知,您不能在 AWS::IncludeParameters 部分中拥有除 Location 键以外的任何内容。检查这里AWS DOC

关于amazon-ec2 - CloudFormation Transform::包含参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54024782/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com