AWS Cloudformation参数依赖性

编程入门 行业动态 更新时间:2024-10-12 03:16:18
本文介绍了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.

如何解决这个问题?

  • 是否可以绕过验证,允许选择的AWS类型为空?
  • 是否可以在Subnet :: Id列表中添加其他选项(如无)?
  • 是否只有在模式为内联的情况下才可以隐藏inlineSubnetId参数?
  • 第二页参数取决于第一参数的输出吗?
  • Is there a way to bypass validation, allowing an AWS type chosen to be empty?
  • Any way to add another option like "None" to the Subnet::Id list?
  • Is there a way to hide the inlineSubnetId parameter only if the mode is inline?
  • 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参数依赖性

    本文发布于:2023-11-30 22:18:24,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1651637.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:依赖性   参数   AWS   Cloudformation

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!