amazon-web-services - CloudFormation 为参数指定 None 值
问题描述
我正在编写一个 cloudformation 模板,并有一个参数来获取 AWS 资源的一组配置值。None
AWS 文档中指定的值之一。但是,当我输入null
cloudformation 时,堆栈失败并显示:
Template validation error: [/Parameters/.../AllowedValues/1] 'null' values are not allowed in templates.
例如,为弹性 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
如何使用该None
值作为参数的选项之一?
解决方案
这在 AWS 上被记录为伪参数。
使用AWS::NoValue
设置 cloudformation 模板的 None 值。
推荐阅读
- php - 在服务器上找不到 Laravel URL
- reactjs - 如何在反应路线中传递多个功能组件?
- angular - 在 Kendo-UI Angular 的动态网格中添加新行
- javascript - VS Code 中的 eslint 未突出显示未声明的变量
- active-directory - 在创建时设置 AD 属性 msDS-cloudExtensionAttribute X
- c# - 检查项目是否包含在列表中
- python - 运行与 twisted.internet.reactor 并行的 couroutine
- elasticsearch - 产品平面数据索引 Magento 2.4.2 索引错误
- bash - 在 bash 管道中“按 Enter”
- arrays - 我想知道二维数组地址的原理是怎样的