我正在尝试执行以下操作:
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的参数类型(即 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参数依赖性
发布评论