!GetAtt无法与cloudformation中的!Sub一起使用

问题描述 投票:0回答:1

我正在尝试使用Cloudformation和无服务器框架来创建一些资源,在该框架中,我需要用其他资源替换资源名称。尝试使用!Sub,但仍然无法创建其他资源的Arn。

[此堆栈溢出问题How to use Sub and GetAtt functions at the same time in CloudFormation template?中的所有方法均无济于事。

感谢您的帮助。

Resources:
  BasicParameter:
    Type: AWS::SSM::Parameter
    Properties:
      Name: /data/config-name
      Type: String
      Value:
        Fn::Base64:
          !Sub |

            {
                "filter_configs": [{
                    "stream_name": !GetAtt tpRecordDeliveryStream.Arn,
                    "events": [
                        {
                            "name": "event_name1",
                            "stream": "streamname1"
                        },
                        {
                            "name": "event_name2"
                        }
                    ]
                }]
            }
      Description: Configuration for stream filters
      Tags:
        project: projectname
        team: data
        owner: owner_name
amazon-web-services amazon-cloudformation serverless-framework
1个回答
0
投票

因为有了!Sub |,而不是

 "stream_name": !GetAtt tpRecordDeliveryStream.Arn,

以下内容就足够了

 "stream_name": "${tpRecordDeliveryStream.Arn}"
© www.soinside.com 2019 - 2024. All rights reserved.