繁体   English   中英

AWS Cloudformation字符串列表错误

[英]AWS Cloudformation Stringlist error

错误:属性验证失败:[属性{/ StreamingDistributionConfig / TrustedSigners / AwsAccountNumbers}的值与类型{Array}不匹配]。

我试图在名为awsAccountNumbers的参数中获取多个帐户ID,为此cloudformation文档说该参数必须为StringList类型。 但是,没有这种类型。 在AWS参数参考中有StringCommaDelimitedList ,我得到了提到的错误。 我也尝试过拆分,但是没有帮助。 请在下面找到我的代码:

**Parameters Section:** 
  "awsAccountNumbers": {
            "Type": "String",

  }

**Resources Section:** 

   "TrustedSigners": {
                        "AwsAccountNumbers": {
                            "Fn::If": [
                                "withRestrictViewerAccessasYes",
                                {
                                    "Fn::If": [
                                        "withTrustedSignersasSelf",
                                        "882410330966",
                                        [
                                            {
                                                "Fn::Select": [
                                                    "0",
                                                    {
                                                        "Fn::Split": [
                                                            ",",

                                                            { "Ref": "awsAccountNumbers" }

                                                        ]
                                                    }
                                                ]
                                            }
                                        ]
                                    ]
                                },
                                {
                                    "Ref": "AWS::NoValue"
                                }
                            ]
                        },
                        "Enabled": {
                            "Ref": "trustedSignersEnabled"
                        }
                    }

我猜错误是指向实际属性( AwsAccountNumbers )而不是参数(awsAccountNumbers)。

AwsAccountNumbers需要一个列表。 它应该像下面这样(未测试)

"Parameters" : {
  "awsAccountNumbers": {
    "Type": "CommaDelimitedList",
     "Default": "882410330966, 882410330966, 882410330966"
  }

{
    "TrustedSigners": {
        "AwsAccountNumbers": [{
            "Fn::If": [
                "withRestrictViewerAccessasYes",
                {
                    "Fn::If": [
                        "withTrustedSignersasSelf",
                        "882410330966", [{
                            "Fn::Select": [
                                "0",
                                {
                                    "Ref": "awsAccountNumbers"
                                }
                            ]
                        }]
                    ]
                },
                {
                    "Ref": "AWS::NoValue"
                }
            ]
        }],
        "Enabled": {
            "Ref": "trustedSignersEnabled"
        }
    }
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM