All Products
Search
Document Center

Resource Orchestration Service:Fn::ListMerge

Last Updated:Mar 15, 2024

The built-in function Fn::ListMerge merges multiple lists into one list.

Declaration

  • JSON

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

    • Syntax for the full function name:

      Fn::ListMerge:
        - - list_1_item_1
          - list_1_item_2
          - ...
        - - list_2_item_1
          - list_2_item_2
          - ...
    • Syntax for the short form:

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

Parameters

  • list_1_item_1, list_1_imte_2, ...: the first list to that you want to merge.

  • list_2_item_1, list_2_imte_2, ...: the second list that you want to merge into the first list.

Examples

In the following example, two Elastic Compute Service (ECS) instance groups are attached to a Server Load Balancer (SLB) instance:

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]

Supported functions