Fn::ListMerge

调用内部函数Fn::ListMerge,合并多个列表为一个列表。

函数声明

  • JSON

    {
      "Fn::ListMerge": [
        [
          "list_1_item_1",
          "list_1_item_2",
          ...
        ],
        [
          "list_2_item_1",
          "list_2_item_2",
          ...
        ],
         ...
      ]
    }
  • YAML

    • 完整函数的语法。

      Fn::ListMerge:
        - - list_1_item_1
          - list_1_item_2
          - ...
        - - list_2_item_1
          - list_2_item_2
          - ...
    • 缩写形式。

      !ListMerge [[list_1_item_1, list_1_item_2, ...], [list_2_item_1, list_2_item_2, ...], ...]

参数信息

  • list_1_item_1, list_1_imte_2, ...:将要合并的第一个列表。

  • list_2_item_1, list_2_imte_2, ...:将要和第一个列表合并的列表。

使用示例

把两个ECS组挂载到同一个负载均衡实例上。

ROSTemplateFormatVersion: '2015-09-01'
Resources:
  LoadBalancer:
    Type: ALIYUN::SLB::LoadBalancer
    Properties:
      LoadBalancerName: ros
      AddressType: internet
      InternetChargeType: paybybandwidth
BackendServer1:
  Type: ALIYUN::ECS::InstanceGroup
  Properties:
    ImageId: m-2ze9uqi7wo61hwep****
    InstanceType: ecs.t1.small
    SecurityGroupId: sg-2ze8yxgempcdsq3i****
    MaxAmount: 1
    MinAmount: 1
BackendServer2:
  Type: ALIYUN::ECS::InstanceGroup
  Properties:
    ImageId: m-2ze9uqi7wo61hwep****
    InstanceType: ecs.t1.small
    SecurityGroupId: sg-2ze8yxgempcdsq3i****
    MaxAmount: 1
    MinAmount: 1
Attachment:
  Type: ALIYUN::SLB::BackendServerAttachment
  Properties:
    LoadBalancerId: !Ref LoadBalancer
  BackendServerList: !ListMerge [!GetAtt BackendServer1.InstanceIds, !GetAtt BackendServer2.InstanceIds]

支持的函数