aws-cloudformation / aws-cloudformation-resource-providers-synthetics

Cloudformation resources for Cloudwatch Synthetics
https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Synthetics_Canaries.html
Apache License 2.0
3 stars 7 forks source link

Upgrading to RPDK 2.0 is failing model validation #16

Closed thinksanky closed 4 years ago

thinksanky commented 4 years ago

Before: My schema has a property called Code as follows:

"Code" : {
            "type" : "object",
            "additionalProperties" : false,
            "properties" : {
                "S3Bucket": {
                    "type": "string"
                },
                "S3Key": {
                    "type": "string"
                },
                "S3ObjectVersion": {
                    "type": "string"
                },
                "Script": {
                    "type": "string"
                },
                "Handler": {
                    "type": "string"
                }
            },
            "oneOf":[
                {
                    "required":[
                        "S3Bucket",
                        "S3Key",
                        "Handler"
                    ]
                },
                {
                    "required":[
                        "Script",
                        "Handler"
                    ]
                }
            ]
        }

Before upgrade to 2.0 from 1.1 there was no error during creating the stack in my integration tests.

But after upgrading to 2.0, I am seeing the following validation error during stack creation ( canary creation which. my resource )

Model validation failed (#/Code: #: only 1 subschema matches out of 2) #/Code: #: 0 subschemas matched instead of one (#/Code)

Here is the input template for Code

Code:
        Handler: "pageLoadBlueprint.handler"
        S3Bucket: !Join [ '', ['aws-synthetics-code-', !Ref 'AWS::AccountId', '-',  !Ref 'AWS::Region' ] ]
        S3Key: "canary/dnd-amazon-hb-blue.zip"
thinksanky commented 4 years ago

Missed to note this:

The resource canary is getting created fine. So I do not see an issue with canary creation.

The issue is the Stack validation failed and it tries to Rollback and then tries to Delete and Delete fails as well. The final state of the Stack is "Delete Failed"

thinksanky commented 4 years ago

This got resolved after upgrading to 2.0.1 RPDK