简体   繁体   English

AWS Cloudformation字符串列表错误

[英]AWS Cloudformation Stringlist error

ERROR: Property validation failure: [Value of property {/StreamingDistributionConfig/TrustedSigners/AwsAccountNumbers} does not match type {Array}]. 错误:属性验证失败:[属性{/ StreamingDistributionConfig / TrustedSigners / AwsAccountNumbers}的值与类型{Array}不匹配]。

I am trying to get multiple account Id's in a parameter called awsAccountNumbers, for which the cloudformation document says this parameter must be of type StringList. 我试图在名为awsAccountNumbers的参数中获取多个帐户ID,为此cloudformation文档说该参数必须为StringList类型。 However, there's no such type. 但是,没有这种类型。 We have String and CommaDelimitedList in the AWS parameters reference for which I get the mentioned error. 在AWS参数参考中有StringCommaDelimitedList ,我得到了提到的错误。 I tried splitting it too, but of no help. 我也尝试过拆分,但是没有帮助。 Please find my code below: 请在下面找到我的代码:

**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"
                        }
                    }

I guess the error points to the actual properties( AwsAccountNumbers ) not the parameter(awsAccountNumbers). 我猜错误是指向实际属性( AwsAccountNumbers )而不是参数(awsAccountNumbers)。

AwsAccountNumbers expects a list. AwsAccountNumbers需要一个列表。 It should be something like below (untested) 它应该像下面这样(未测试)

"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