3
votes

I'm trying to create a nested stack with the root stack looks like this:

{
    "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": {

    }
}

And I get this error:

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

It looks like my identity pool stack has some issues with the parameters. But the identity pool stack parameters look like this:

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

The funny thing is: I tried creating each stack on its own, then passed the outputs from them as parameters to the stacks that need those parameters and every single stack was created successfully without any problems.

I've tried to look for what is unsupported but was unable to find any answers.

1
The "Parameters" and "TemplateURL" properties are valid on a "AWS::CloudFormation::Stack" resource type, but your identity pool resource is an actual "AWS::Cognito::IdentityPool" type, not a stack, so those properties are not valid on that resource type.404
@404 Once again, you're correct!Viet
Please let me know if you want to post your answer here so I can close this question. Thank you.Viet
No problem. Posted as answer.404

1 Answers

5
votes

The error:

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

Says that those two properties are unsupported. Unlike all the rest of the resources declared in your template which also use those two properties, this resource is a AWS::Cognito::IdentityPool, while the rest are all of type AWS::CloudFormation::Stack.

Those two properties are only valid on the AWS::CloudFormation::Stack type, hence the validation error.