CloudFormation 为参数指定 None 值

cpp*_*ner 5 amazon-web-services aws-cloudformation

我正在编写一个 cloudformation 模板,并有一个参数来接收一组 AWS 资源的配置值。其中一个值None在 AWS 文档中指定。但是,当我输入null到 cloudformation 时,堆栈失败并显示:

Template validation error: [/Parameters/.../AllowedValues/1] 'null' values are not allowed in templates.
Run Code Online (Sandbox Code Playgroud)

例如,为弹性 beanstalk 设置许多配置之一,默认为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
Run Code Online (Sandbox Code Playgroud)

如何使用该None值作为参数的选项之一?

cpp*_*ner 10

这在 AWS 上被记录为伪参数

UsingAWS::NoValue为 cloudformation 模板设置 None 值。