CloudFormation YAML 结合 FN::GEtAtt 和 !Ref 列出 id
CloudFormation YAML combining FN::GEtAtt and !Ref to list ids
正在努力解决生成 VPCSecurityGroupIds 的 CloudFormation 语法(在我的例子中为 1)。我有下面的 yaml,基本上是尝试在 GetAtt 函数中引用参数 SecurityGroupName。不幸的是,当我知道我正在传递正确的 SecurityGroupName 值时,我得到“参数 [SecurityGroupName] 必须具有值。非常感谢任何对此嵌套的见解。
Properties:
VpcSecurityGroupIds:
- "Fn::GetAtt": [ !Ref SecurityGroupName , "GroupId"]
Translates to
Properties:
VpcSecurityGroupIds:
- Fn:G:GetAtt:
- Ref: SecurityGroupName
- GroupId
试试这个:
Properties:
VpcSecurityGroupIds:
- Fn::GetAtt:
- !Ref SecurityGroupName
- GroupId
我在几个地方都使用它。 sample中也包含resource Type,会更容易找到你说的。
还要确保您确实传递了 SecurityGroupName
值,将其添加到设置为默认值的参数中。
你不能这样做。 Fn::GetAtt
的参数不能是任何函数。来自 docs:
For the Fn::GetAtt logical resource name, you can't use functions. You must specify a string that's a resource's logical ID.
正在努力解决生成 VPCSecurityGroupIds 的 CloudFormation 语法(在我的例子中为 1)。我有下面的 yaml,基本上是尝试在 GetAtt 函数中引用参数 SecurityGroupName。不幸的是,当我知道我正在传递正确的 SecurityGroupName 值时,我得到“参数 [SecurityGroupName] 必须具有值。非常感谢任何对此嵌套的见解。
Properties:
VpcSecurityGroupIds:
- "Fn::GetAtt": [ !Ref SecurityGroupName , "GroupId"]
Translates to
Properties:
VpcSecurityGroupIds:
- Fn:G:GetAtt:
- Ref: SecurityGroupName
- GroupId
试试这个:
Properties:
VpcSecurityGroupIds:
- Fn::GetAtt:
- !Ref SecurityGroupName
- GroupId
我在几个地方都使用它。 sample中也包含resource Type,会更容易找到你说的。
还要确保您确实传递了 SecurityGroupName
值,将其添加到设置为默认值的参数中。
你不能这样做。 Fn::GetAtt
的参数不能是任何函数。来自 docs:
For the Fn::GetAtt logical resource name, you can't use functions. You must specify a string that's a resource's logical ID.