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?
Pseudo parameters are parameters that are predefined by AWS CloudFormation. You don't declare them in your template. Use them the same way as you would a parameter, as the argument for the Ref function.
You use the Ref intrinsic function to reference a parameter, and AWS CloudFormation uses the parameter's value to provision the stack. You can reference parameters from the Resources and Outputs sections of the same template.
Fn::If. Returns one value if the specified condition evaluates to true and another value if the specified condition evaluates to false .
Depending on the entity you want to conditionally create or configure, you must include statements in the following template sections: Parameters section. Define the inputs that you want your conditions to evaluate. The conditions evaluate to true or false based on the values of these input parameters.
This is documented as Pseudo parameters on AWS.
Using AWS::NoValue
sets the None value for the cloudformation templates.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With