Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/drupal/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon cloudformation 我可以在CloudFormation中使用映射来定义参数吗?_Amazon Cloudformation - Fatal编程技术网

Amazon cloudformation 我可以在CloudFormation中使用映射来定义参数吗?

Amazon cloudformation 我可以在CloudFormation中使用映射来定义参数吗?,amazon-cloudformation,Amazon Cloudformation,这是我的模板的重要部分: Parameters: EnvType: Description: Environment type. Type: String AllowedValues: - prod - test Mappings: EnvDomain: Primary: prod: "prodexample.com" test: "testexample.com"

这是我的模板的重要部分:

Parameters:

  EnvType:
    Description: Environment type.
    Type: String
    AllowedValues:
      - prod
      - test

Mappings:
  EnvDomain:
    Primary:
      prod: "prodexample.com"
      test: "testexample.com"
我的问题是,我是否可以添加一个参数(当然可以在“参数:”下),该参数的值由映射定义?它看起来像这样:

  DomainName:
    Type: String
    Default: !FindInMap ["EnvDomain", "Primary", "${EnvType}"

我不知道该怎么做!在那里分环境类型,可以!可以使用join,或者这是可能的吗?

从语义的角度来看,我建议如下:

  • 参数是变量输入
  • 映射是整个模板所需的静态常量
在资源部分中使用参数和映射的组合,例如

!附属的
-vpc-${myParam}-${myMapping}
-myParam:!参考参数1
myMapping:!FindInMap[x,y,z]
我的问题是,我是否可以添加一个参数(当然可以在“参数:”下),该参数的值由映射定义

遗憾的是,你不能这样做。此类功能不受支持