Unfortunately that doesn't work with the Alias plugin 😢
While the Conditions section properly appears in the cloudformation-template-update-stack.json stack, it's missing in the cloudformation-template-update-alias-stack.json one. This causes an error during deployment:
Template format error: Condition IsProdCondition is not defined.
The simplest solution should be to copy the Conditions section in both stack JSONs. Then it's accessible in both cases and even if might not always be necessary, it doesn't hurt to have a superfluous condition defined either.
I'm trying to use AWS Conditions in order to create conditional Resources.
Conditions generally work like this in your
serverless.yaml
:Unfortunately that doesn't work with the Alias plugin 😢
While the
Conditions
section properly appears in thecloudformation-template-update-stack.json
stack, it's missing in thecloudformation-template-update-alias-stack.json
one. This causes an error during deployment:The simplest solution should be to copy the
Conditions
section in both stack JSONs. Then it's accessible in both cases and even if might not always be necessary, it doesn't hurt to have a superfluous condition defined either.