Condition

The condition method maps to the CloudFormation Template Anatomy Conditions section.

Example Snippets

There are 2 forms for conditions. Here are example snippets:

# medium form
condition "CreateProdResources", equals(ref("EnvType"), "prod")

# medium form with a Fn::Equals example
condition("CreateDevResources",
  "Fn::Equals": [
    ref("EnvType"),
    "dev"
  ]
)

# long form
condition("CreateStagResources",
  "Fn::Equals": [
    {"Ref": "EnvType"},
    "stag"
  ]
)

Output

Conditions:
  CreateProdResources:
    Fn::Equals:
    - Ref: EnvType
    - prod
  CreateDevResources:
    Fn::Equals:
    - Ref: EnvType
    - dev
  CreateStagResources:
    Fn::Equals:
    - Ref: EnvType
    - stag

Back to DSL List Docs.

Pro tip: Use the <- and -> arrow keys to move back and forward.

Edit this page

See a typo or an error? You can improve this page. This website is available on GitHub and contributions are encouraged and welcomed. We love pull requests from you!