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 :create_prod_resources, equals(ref(:env_type), "prod")

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

# long form
condition create_stag_resources: {
  "Fn::Equals": [
    {"Ref": "env_type"},
    "stag"
  ]
}

Output

Conditions:
  CreateProdResources:
    Fn::Equals:
    - Ref: EnvType
    - prod
  CreateDevResources:
    Fn::Equals:
    - Ref: EnvType
    - dev
  CreateStagResources:
    Fn::Equals:
    - Ref: env_type
    - 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!