Conditional KinesisStreamSpecification in CloudFormation script

I am new to CloudFoundation scripts and trying to set the conditional attribute for AWS DDB table using the yaml files.

Tried with below but getting error during the stack formation - Property StreamArn cannot be empty.

Seems its not allowing AWS::NoValue in this case.

Can we set the 'KinesisStreamSpecification' property itself on the condition?

      KinesisStreamSpecification:
          StreamArn: !If
          - ShouldAttachKinesis
          - !Sub "arn:aws:kinesis:SomeValue"
          - !Ref "AWS::NoValue"

1 answer

  • answered 2022-05-07 00:12 Marcin

    Your If should be one level up:

          KinesisStreamSpecification:
            !If
              - ShouldAttachKinesis
              - StreamArn: !Sub "arn:aws:kinesis:SomeValue"
              - !Ref "AWS::NoValue"
    

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum