Reputation: 162
I am new to writing AWS Cloudformation templates. I am trying to use If Else conditions on my CF template. How can I use if else statements with resources?
If AWS::Region == eu-central-1 ==> create resource , else continue.
Upvotes: 8
Views: 14781
Reputation: 4616
Define a condition in the conditions sections
Conditions:
createResource: !Equals [ !Ref 'AWS::Region', 'eu-central-1']
Then on your resources
Resources:
MyResourcesOnlyCreatedSometime:
Condition: createResource
Type: AWS::Blah::Blah
Upvotes: 17