aws-cloudformation / aws-cloudformation/cloudformation-coverage-roadmap

Fn::Contains should be a supported Condition (as well as Fn::EachMemberIn, Fn::EachMemberEquals)

Open
#1,973 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
No language data
Stars
1.1k
Forks
62
PR merge metrics
No merged PRs in 30d

Description

### Name of the resource

Other

### Resource name

Fn::Condition intrinsic function

### Description

Cloudformation only supports Equals / And / Or / Not as intrisics for [Conditions](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-conditions.html)

However there are additional intrinsic functions representing Conditions supported in the [Rules section](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-rules.html), such as `Contains`, `EachMemberIn`, and `EachMemberEquals`.

Notably, the CDK documentation [represents these the same](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Fn.html#class-fn), ie there is no indication of a distinction between `conditionAnd` vs `conditionContains`; but if you attempt to use a `Contains` condition in the Conditions block, you will get an error at changeset creation.

I have a use case where I want to condition resource creation on the presence of a string in a SSM StringList Parameter evaluated at deploy-time. I am currently unable to do this.

My only workaround is leveraging a transform/macro which evaluates and replaces these conditions at macro-time.

### Other Details

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.