【问题标题】:Combination Fn::Select + Fn::Split + Fn:GetAtt in Cloudformation templateCloudformation 模板中的 Fn::Select + Fn::Split + Fn:GetAtt 组合
【发布时间】:2020-01-08 05:47:32
【问题描述】:

我正在尝试使用以下 cloudformation 堆栈,但一直失败并出现以下错误:

模板错误:每个 Fn::Split 对象都需要两个参数,(1) 字符串分隔符和 (2) 要拆分的字符串或返回要拆分的字符串的函数。

  {
      "Type": "AWS::Route53Resolver::ResolverRule",
      "Properties": {
        "DomainName": {"Fn::Sub": "ad.${EnvName}.yyy.xxx.com"},
        "Name": {"Fn::Sub": "${EnvName}"},
        "ResolverEndpointId": "1",
        "RuleType": "FORWARD",
        "Tags" : [
          {
            "Key": "Name",
            "Value": {
              "Fn::Sub": "${EnvName}-ADResolverRule"
            }
          }
        ],
        "TargetIps": [
            {
                "Ip": {
                    "Fn::Select": [
                        0,
                        {
                            "Fn::Split": [
                                ",",
                                {
                                  "Fn::GetAtt": [
                                      "MicrosoftAD",
                                      "DnsIpAddresses"
                                  ]
                                }
                            ]
                        }
                    ]
                },
                "Port": "53"
            }
        ]
      }
    }

不太确定为什么我有 Fn::Split 函数的值,任何帮助将不胜感激。

谢谢。

【问题讨论】:

    标签: amazon-web-services amazon-cloudformation


    【解决方案1】:

    问题似乎是您不需要在这里调用 split 。当您调用 Fn::GetAtt 时,在这种情况下它不会创建字符串。如果您查看documentation,它会生成一个列表对象。查看各种examples,您会发现不需要拆分。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-08-04
      • 2018-05-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-25
      相关资源
      最近更新 更多