zachd1_618
zachd1_618

Reputation: 4340

Use Operators on Multiple Conditions in Cloudformation

I am trying to control the creation of a resource with two Cloudformation Condition specifications.

AWSTemplateFormatVersion: 2010-09-09
Conditions:
    PROD: ...
    REGION_A:...

These conditions work fine to regulate the creation of resources on their own, but I cannot figure out how to use them both in conjunction without defining a single purpose built Condition that melds the two.

ResourceA:
    ...
    Condition: {"Fn::And": [{"Condition": "PROD"},{"Condition": "REGION_A"}]}

I have tried a few combitionations and variations of the above, but get an error like the following.

Fn::And object requires a list of at least 2 and at most 10 boolean parameters

Upvotes: 1

Views: 1814

Answers (1)

Orest
Orest

Reputation: 6748

Creating new condition which depends on those two is the only way to solve it.

Conditions:
    PROD: ...
    REGION_A:..
    PROD_REGION: {"Fn::And": [{"Condition": "PROD"},{"Condition": "REGION_A"}]}

Unfortunately I cannot find proofs in the documentation.

Upvotes: 2

Related Questions