hangc
hangc

Reputation: 5473

CloudFormation specify None value for parameter

I am writing a cloudformation template and have a parameter to take in a set of configuration values for AWS resources. One of the value is None as specified on the AWS documentation. However when I input null into the cloudformation, the stack fails with:

Template validation error: [/Parameters/.../AllowedValues/1] 'null' values are not allowed in templates.

For example setting one of the many configurations for elastic beanstalk which defaults to None:

Parameters:
  EC2KeyPairName:
    Description: EC2 key pair name for SSH access
    Type: AWS::EC2::KeyPair::KeyName
    Default: null

Resources:
  Type: AWS::ElasticBeanstalk::ConfigurationTemplate
    Properties:
      ApplicationName: !Ref Application
      SolutionStackName: !FindInMap [ StackMap, !Ref StackType, stackName ]
      OptionSettings:
        - Namespace: aws:autoscaling:launchconfiguration
          OptionName: EC2KeyName
          Value: !Ref EC2KeyPairName

How do I use the None value as one of the options for the parameter?

Upvotes: 11

Views: 14925

Answers (1)

hangc
hangc

Reputation: 5473

This is documented as Pseudo parameters on AWS.

Using AWS::NoValue sets the None value for the cloudformation templates.

Upvotes: 16

Related Questions