AWS Cloudformation参数依赖性 [英] AWS Cloudformation parameter dependency

查看:76
本文介绍了AWS Cloudformation参数依赖性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试执行以下操作:

I'm trying to do the following:

"Parameters": {
    "InterfaceMode" : {
        "Description": "Configure instance to run in onearm or inline mode",
        "Type": "String",
        "Default": "onearm",
        "AllowedValues": [ "onearm", "inline" ], 
    }
    "InlineSubnetId" : {
        "Description": "Name of a subnet assigned to the VPC to use for second interface in inline mode.", 
        "Type": "AWS::EC2::Subnet::Id",
        "Default": "None"
    },

现在,如果用户选择单臂,则只需要一个接口,而不需要InlineSubnetId。通常,用户会将 InlineSubnetId下拉列表留空,但这不适用于cloudformation验证,因为它需要AWS类型的值。我不能只使用字符串类型,而是希望用户从AWS提供的SubnetId中进行选择。

Now if the user selects onearm, only one interface is needed and the InlineSubnetId is not needed. Usually the user would leave the "InlineSubnetId" drop down empty, but this doesn't work with cloudformation validation since it requires a value for AWS types. I can't just use a string type as I want the user to select from AWS-supplied SubnetIds.

如何解决这个问题?


  1. 是否可以绕过验证,允许选择的AWS类型为空?

  2. 是否可以在Subnet :: Id列表中添加其他选项(如无)?

  3. 是否只有在模式为内联的情况下才可以隐藏inlineSubnetId参数?

  4. 第二页参数取决于第一参数的输出吗?

  1. Is there a way to bypass validation, allowing an AWS type chosen to be empty?
  2. Any way to add another option like "None" to the Subnet::Id list?
  3. Is there a way to hide the inlineSubnetId parameter only if the mode is inline?
  4. How about a second page of parameters, that depends on the output of the first page of paramters?

感谢您的帮助。

推荐答案

不幸的是,如果您希望参数是可选的,则不能使用任何特定于AWS的参数类型(即 AWS :: * )。您所希望的解决方法也都无效。我建议将类型为 String AllowedPattern 设置为类似于 ^(subnet- [0-9a-fA-F] {8})?$ ,但这将无法满足您使下拉列表中预先填充现有子网值的要求。

Unfortunately, if you want a Parameter to be optional, you can not use any of the AWS-specific parameter types (i.e. AWS::*). None of your hoped-for workarounds will work, either. I'd recommend a type String with an AllowedPattern set to something like ^(subnet-[0-9a-fA-F]{8})?$, but this will not meet your requirement of making the drop-down prepopulated with existing subnet values.

这篇关于AWS Cloudformation参数依赖性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆