This will cause a cloudformation update failure when Model2 is being applied earlier than Model1. This is due to the CloudFormation update template not including any dependency between the models. With Model1 not yet existing, the canonical $ref URL will be invalid and AWS will reject Model2 and fail the stack update completely.
Essentially, there is a need to specify how models depend on each other, optionally similar to other resources using the "dependsOn" keyword. Or even better, detect the dependency automatically and inject the "dependsOn" in the CF template correctly.
Can someone please confirm if this is a valid issue? I'd be happy to make a PR myself with some guidance.
Imagine Mode2 references Model1 using the $ref keyword, and both models are defined in the models section of the serverless.yml file:
Model2:
serverless.yml
This will cause a cloudformation update failure when Model2 is being applied earlier than Model1. This is due to the CloudFormation update template not including any dependency between the models. With Model1 not yet existing, the canonical $ref URL will be invalid and AWS will reject Model2 and fail the stack update completely.
Essentially, there is a need to specify how models depend on each other, optionally similar to other resources using the "dependsOn" keyword. Or even better, detect the dependency automatically and inject the "dependsOn" in the CF template correctly.
Can someone please confirm if this is a valid issue? I'd be happy to make a PR myself with some guidance.