Cloudformation属性验证失败:遇到了不受支持的属性

时间:2019-06-19 19:45:46

标签: amazon-web-services amazon-cloudformation amazon-cognito

我正在尝试创建一个嵌套堆栈,其根堆栈看起来像这样:

{
    "AWSTemplateFormatVersion": "2010-09-09",

    "Resources": {
        "DynamoDBTable": {
            "Type": "AWS::CloudFormation::Stack",
            "Properties": {
                "Parameters": {
                    "TableName": {
                        "Fn::Sub": "${AWS::StackName}"
                    }
                },
                "TemplateURL": "https://s3.amazonaws.com/my-templates-bucket/dynamodb.json"
            }
        },
        "S3WebsiteReact": {
            "Type": "AWS::CloudFormation::Stack",
            "Properties": {
                "Parameters": {
                    "BucketName": {
                        "Fn::Sub": "${AWS::StackName}-website"
                    }
                },
                "TemplateURL": "https://s3.amazonaws.com/my-templates-bucket/s3-static-website-react.json"
            }
        },
        "S3UploadBucket": {
            "Type": "AWS::CloudFormation::Stack",
            "Properties": {
                "Parameters": {
                    "BucketName": {
                        "Fn::Sub": "${AWS::StackName}-upload"
                    }
                },
                "TemplateURL": "https://s3.amazonaws.com/my-templates-bucket/s3-with-cors.json"
            }
        },
        "Cognito": {
            "Type": "AWS::CloudFormation::Stack",
            "DependsOn": "DynamoDBTable",
            "Properties": {
                "Parameters": {
                    "CognitoUserPoolName": {
                        "Fn::Join" : ["",
                            {
                                "Fn::Split": ["-", {
                                    "Ref": "AWS::StackName"
                                }]
                            }
                        ]
                    }
                },
                "TemplateURL": "https://s3.amazonaws.com/my-templates-bucket/cognito.json"
            }
        },
        "ApiGateway": {
            "Type": "AWS::CloudFormation::Stack",
            "DependsOn": ["DynamoDBTable", "Cognito"],
            "Properties": {
                "Parameters": {
                    "ApiGatewayName": {
                        "Fn::Sub": "${AWS::StackName}-api"
                    },
                    "CognitoUserPoolArn": {
                        "Fn::GetAtt": [ "Cognito", "Outputs.UserPoolArn" ]
                    },
                    "DynamoDBStack": {
                        "Fn::GetAtt": [ "DynamoDBTable", "Outputs.DDBStackName" ]
                    }
                },
                "TemplateURL": "https://s3.amazonaws.com/my-templates-bucket/api-gateway.json"
            }
        },
        "IdentityPool": {
            "Description": "Cognito Identity Pool. Must be created after User Pool and API Gateway.",
            "Type": "AWS::Cognito::IdentityPool",
            "DependsOn": ["Cognito", "ApiGateway", "S3UploadBucket"],
            "Properties": {
                "Parameters": {
                    "AppClientId": {
                        "Fn::GetAtt": [ "Cognito", "Outputs.AppClientId" ]
                    },
                    "UserPoolProviderName": {
                        "Fn::GetAtt": [ "Cognito", "Outputs.ProviderName" ]
                    },
                    "UserPoolName": {
                        "Fn::GetAtt": [ "Cognito", "Outputs.UserPoolName" ]
                    },
                    "UploadBucketName": {
                        "Fn::GetAtt": [ "S3UploadBucket", "Outputs.UploadBucketName" ]
                    },
                    "ApiGatewayId": {
                        "Fn::GetAtt": [ "ApiGateway", "Outputs.ApiGatewayId" ]
                    }
                },
                "TemplateURL": "https://s3.amazonaws.com/my-templates-bucket/identity-pool.json"
            }
        }
    },

    "Outputs": {

    }
}

我收到此错误:

2019-06-19 14:45:14 UTC-0400    IdentityPool    CREATE_FAILED   Property validation failure: [Encountered unsupported properties in {/}: [TemplateURL, Parameters]]

看来我的identity pool stack的参数有问题。但是identity pool stack参数看起来像这样:

"Parameters" : {
        "AppClientId": {
            "Description": "ID of the App Client of the Cognito User Pool passed into this stack.",
            "Type": "String"
        },
        "UserPoolProviderName": {
            "Description": "Cognito User Pool Provider name passed into this stack.",
            "Type": "String"
        },
        "UserPoolName": {
            "Description": "Cognito User Pool Name passed into this stack.",
            "Type": "String"
        },
        "UploadBucketName": {
            "Description": "Name of the bucket that is used to upload files to.",
            "Type": "String"
        },
        "ApiGatewayId": {
            "Description": "ID of the API Gateway created for the stack.",
            "Type": "String"
        }
    },

有趣的是:我尝试自行创建每个堆栈,然后将它们的输出作为参数传递给需要这些参数的堆栈,每个成功创建的堆栈都没有问题。

我试图寻找不受支持但找不到任何答案的内容。

1 个答案:

答案 0 :(得分:1)

错误:

[Encountered unsupported properties in {/}: [TemplateURL, Parameters]]

表示不支持这两个属性。与模板中声明的所有其余资源也使用这两个属性的情况不同,此资源为AWS::Cognito::IdentityPool,而其余资源均为AWS::CloudFormation::Stack类型。

这两个属性仅在AWS::CloudFormation::Stack类型上有效,因此验证错误。