1. Registry
  2. Packages
  3. Alibaba Cloud Provider
  4. API Docs
  5. vpc
  6. RouteTargetGroup
Viewing docs for Alibaba Cloud v3.108.0
published on Thursday, Sep 17, 2026 by Pulumi
alicloud logo alicloud logo
Viewing docs for Alibaba Cloud v3.108.0
published on Thursday, Sep 17, 2026 by Pulumi

    Provides a VPC Route Target Group resource.

    Route target group.

    For information about VPC Route Target Group and how to use it, see What is Route Target Group.

    NOTE: Available since v1.292.0.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "terraform-example";
    const region = config.get("region") || "cn-wulanchabu";
    const zoneId1 = config.get("zoneId1") || "cn-wulanchabu-b";
    const zoneId2 = config.get("zoneId2") || "cn-wulanchabu-c";
    const _default = new alicloud.vpc.Network("default", {
        vpcName: name,
        cidrBlock: "192.168.0.0/16",
    });
    const zoneA = new alicloud.vpc.Switch("zone_a", {
        vpcId: _default.id,
        zoneId: zoneId1,
        cidrBlock: "192.168.0.0/24",
    });
    const zoneB = new alicloud.vpc.Switch("zone_b", {
        vpcId: _default.id,
        zoneId: zoneId2,
        cidrBlock: "192.168.1.0/24",
    });
    // Active member (zone A): GWLB load balancer + GWLB-type endpoint service +
    // service-resource attachment + GatewayLoadBalancer endpoint. The endpoint
    // depends_on the service-resource so the GWLB is attached to the service
    // before the endpoint is created.
    const active = new alicloud.gwlb.LoadBalancer("active", {
        loadBalancerName: `${name}-gwlb-active`,
        addressIpVersion: "Ipv4",
        vpcId: _default.id,
        zoneMappings: [{
            vswitchId: zoneA.id,
            zoneId: zoneId1,
        }],
    });
    const activeVpcEndpointService = new alicloud.privatelink.VpcEndpointService("active", {
        autoAcceptConnection: true,
        serviceDescription: `${name}-eps-active`,
        serviceResourceType: "gwlb",
    });
    const activeVpcEndpointServiceResource = new alicloud.privatelink.VpcEndpointServiceResource("active", {
        resourceId: active.id,
        resourceType: "gwlb",
        serviceId: activeVpcEndpointService.id,
        zoneId: zoneId1,
        dryRun: false,
    });
    const activeVpcEndpoint = new alicloud.privatelink.VpcEndpoint("active", {
        serviceId: activeVpcEndpointService.id,
        vpcEndpointName: `${name}-ep-active`,
        vpcId: _default.id,
        serviceName: activeVpcEndpointService.vpcEndpointServiceName,
        endpointType: "GatewayLoadBalancer",
    });
    // Attach zone A to the GWLB endpoint. The route target group backend looks up
    // the member endpoint by zone, so the endpoint must carry a non-empty zone.
    const activeVpcEndpointZone = new alicloud.privatelink.VpcEndpointZone("active", {
        endpointId: activeVpcEndpoint.id,
        vswitchId: zoneA.id,
    });
    // Standby member (zone B): identical chain in a different zone so the two
    // members satisfy active-standby's two-different-zone rule.
    const standby = new alicloud.gwlb.LoadBalancer("standby", {
        loadBalancerName: `${name}-gwlb-standby`,
        addressIpVersion: "Ipv4",
        vpcId: _default.id,
        zoneMappings: [{
            vswitchId: zoneB.id,
            zoneId: zoneId2,
        }],
    });
    const standbyVpcEndpointService = new alicloud.privatelink.VpcEndpointService("standby", {
        autoAcceptConnection: true,
        serviceDescription: `${name}-eps-standby`,
        serviceResourceType: "gwlb",
    });
    const standbyVpcEndpointServiceResource = new alicloud.privatelink.VpcEndpointServiceResource("standby", {
        resourceId: standby.id,
        resourceType: "gwlb",
        serviceId: standbyVpcEndpointService.id,
        zoneId: zoneId2,
        dryRun: false,
    });
    const standbyVpcEndpoint = new alicloud.privatelink.VpcEndpoint("standby", {
        serviceId: standbyVpcEndpointService.id,
        vpcEndpointName: `${name}-ep-standby`,
        vpcId: _default.id,
        serviceName: standbyVpcEndpointService.vpcEndpointServiceName,
        endpointType: "GatewayLoadBalancer",
    });
    // Attach zone B to the standby GWLB endpoint (different zone from active).
    const standbyVpcEndpointZone = new alicloud.privatelink.VpcEndpointZone("standby", {
        endpointId: standbyVpcEndpoint.id,
        vswitchId: zoneB.id,
    });
    // The route target group depends_on both endpoint zones: the backend looks up
    // each member endpoint by zone, so the zones must exist before Create is called.
    const defaultRouteTargetGroup = new alicloud.vpc.RouteTargetGroup("default", {
        routeTargetGroupName: name,
        routeTargetGroupDescription: name,
        vpcId: _default.id,
        configMode: "Active-Standby",
        routeTargetMemberLists: [
            {
                memberId: activeVpcEndpoint.id,
                memberType: "GatewayLoadBalancerEndpoint",
                weight: 100,
            },
            {
                memberId: standbyVpcEndpoint.id,
                memberType: "GatewayLoadBalancerEndpoint",
                weight: 0,
            },
        ],
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "terraform-example"
    region = config.get("region")
    if region is None:
        region = "cn-wulanchabu"
    zone_id1 = config.get("zoneId1")
    if zone_id1 is None:
        zone_id1 = "cn-wulanchabu-b"
    zone_id2 = config.get("zoneId2")
    if zone_id2 is None:
        zone_id2 = "cn-wulanchabu-c"
    default = alicloud.vpc.Network("default",
        vpc_name=name,
        cidr_block="192.168.0.0/16")
    zone_a = alicloud.vpc.Switch("zone_a",
        vpc_id=default.id,
        zone_id=zone_id1,
        cidr_block="192.168.0.0/24")
    zone_b = alicloud.vpc.Switch("zone_b",
        vpc_id=default.id,
        zone_id=zone_id2,
        cidr_block="192.168.1.0/24")
    # Active member (zone A): GWLB load balancer + GWLB-type endpoint service +
    # service-resource attachment + GatewayLoadBalancer endpoint. The endpoint
    # depends_on the service-resource so the GWLB is attached to the service
    # before the endpoint is created.
    active = alicloud.gwlb.LoadBalancer("active",
        load_balancer_name=f"{name}-gwlb-active",
        address_ip_version="Ipv4",
        vpc_id=default.id,
        zone_mappings=[{
            "vswitch_id": zone_a.id,
            "zone_id": zone_id1,
        }])
    active_vpc_endpoint_service = alicloud.privatelink.VpcEndpointService("active",
        auto_accept_connection=True,
        service_description=f"{name}-eps-active",
        service_resource_type="gwlb")
    active_vpc_endpoint_service_resource = alicloud.privatelink.VpcEndpointServiceResource("active",
        resource_id=active.id,
        resource_type="gwlb",
        service_id=active_vpc_endpoint_service.id,
        zone_id=zone_id1,
        dry_run=False)
    active_vpc_endpoint = alicloud.privatelink.VpcEndpoint("active",
        service_id=active_vpc_endpoint_service.id,
        vpc_endpoint_name=f"{name}-ep-active",
        vpc_id=default.id,
        service_name=active_vpc_endpoint_service.vpc_endpoint_service_name,
        endpoint_type="GatewayLoadBalancer")
    # Attach zone A to the GWLB endpoint. The route target group backend looks up
    # the member endpoint by zone, so the endpoint must carry a non-empty zone.
    active_vpc_endpoint_zone = alicloud.privatelink.VpcEndpointZone("active",
        endpoint_id=active_vpc_endpoint.id,
        vswitch_id=zone_a.id)
    # Standby member (zone B): identical chain in a different zone so the two
    # members satisfy active-standby's two-different-zone rule.
    standby = alicloud.gwlb.LoadBalancer("standby",
        load_balancer_name=f"{name}-gwlb-standby",
        address_ip_version="Ipv4",
        vpc_id=default.id,
        zone_mappings=[{
            "vswitch_id": zone_b.id,
            "zone_id": zone_id2,
        }])
    standby_vpc_endpoint_service = alicloud.privatelink.VpcEndpointService("standby",
        auto_accept_connection=True,
        service_description=f"{name}-eps-standby",
        service_resource_type="gwlb")
    standby_vpc_endpoint_service_resource = alicloud.privatelink.VpcEndpointServiceResource("standby",
        resource_id=standby.id,
        resource_type="gwlb",
        service_id=standby_vpc_endpoint_service.id,
        zone_id=zone_id2,
        dry_run=False)
    standby_vpc_endpoint = alicloud.privatelink.VpcEndpoint("standby",
        service_id=standby_vpc_endpoint_service.id,
        vpc_endpoint_name=f"{name}-ep-standby",
        vpc_id=default.id,
        service_name=standby_vpc_endpoint_service.vpc_endpoint_service_name,
        endpoint_type="GatewayLoadBalancer")
    # Attach zone B to the standby GWLB endpoint (different zone from active).
    standby_vpc_endpoint_zone = alicloud.privatelink.VpcEndpointZone("standby",
        endpoint_id=standby_vpc_endpoint.id,
        vswitch_id=zone_b.id)
    # The route target group depends_on both endpoint zones: the backend looks up
    # each member endpoint by zone, so the zones must exist before Create is called.
    default_route_target_group = alicloud.vpc.RouteTargetGroup("default",
        route_target_group_name=name,
        route_target_group_description=name,
        vpc_id=default.id,
        config_mode="Active-Standby",
        route_target_member_lists=[
            {
                "member_id": active_vpc_endpoint.id,
                "member_type": "GatewayLoadBalancerEndpoint",
                "weight": 100,
            },
            {
                "member_id": standby_vpc_endpoint.id,
                "member_type": "GatewayLoadBalancerEndpoint",
                "weight": 0,
            },
        ])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/gwlb"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/privatelink"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		name := "terraform-example"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		region := "cn-wulanchabu"
    		if param := cfg.Get("region"); param != "" {
    			region = param
    		}
    		zoneId1 := "cn-wulanchabu-b"
    		if param := cfg.Get("zoneId1"); param != "" {
    			zoneId1 = param
    		}
    		zoneId2 := "cn-wulanchabu-c"
    		if param := cfg.Get("zoneId2"); param != "" {
    			zoneId2 = param
    		}
    		_default, err := vpc.NewNetwork(ctx, "default", &vpc.NetworkArgs{
    			VpcName:   pulumi.String(name),
    			CidrBlock: pulumi.String("192.168.0.0/16"),
    		})
    		if err != nil {
    			return err
    		}
    		zoneA, err := vpc.NewSwitch(ctx, "zone_a", &vpc.SwitchArgs{
    			VpcId:     _default.ID().ToIDOutput().ToStringOutput(),
    			ZoneId:    pulumi.String(zoneId1),
    			CidrBlock: pulumi.String("192.168.0.0/24"),
    		})
    		if err != nil {
    			return err
    		}
    		zoneB, err := vpc.NewSwitch(ctx, "zone_b", &vpc.SwitchArgs{
    			VpcId:     _default.ID().ToIDOutput().ToStringOutput(),
    			ZoneId:    pulumi.String(zoneId2),
    			CidrBlock: pulumi.String("192.168.1.0/24"),
    		})
    		if err != nil {
    			return err
    		}
    		// Active member (zone A): GWLB load balancer + GWLB-type endpoint service +
    		// service-resource attachment + GatewayLoadBalancer endpoint. The endpoint
    		// depends_on the service-resource so the GWLB is attached to the service
    		// before the endpoint is created.
    		active, err := gwlb.NewLoadBalancer(ctx, "active", &gwlb.LoadBalancerArgs{
    			LoadBalancerName: pulumi.Sprintf("%v-gwlb-active", name),
    			AddressIpVersion: pulumi.String("Ipv4"),
    			VpcId:            _default.ID().ToIDOutput().ToStringOutput(),
    			ZoneMappings: gwlb.LoadBalancerZoneMappingArray{
    				&gwlb.LoadBalancerZoneMappingArgs{
    					VswitchId: zoneA.ID().ToIDOutput().ToStringOutput(),
    					ZoneId:    pulumi.String(zoneId1),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		activeVpcEndpointService, err := privatelink.NewVpcEndpointService(ctx, "active", &privatelink.VpcEndpointServiceArgs{
    			AutoAcceptConnection: pulumi.Bool(true),
    			ServiceDescription:   pulumi.Sprintf("%v-eps-active", name),
    			ServiceResourceType:  pulumi.String("gwlb"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = privatelink.NewVpcEndpointServiceResource(ctx, "active", &privatelink.VpcEndpointServiceResourceArgs{
    			ResourceId:   active.ID().ToIDOutput().ToStringOutput(),
    			ResourceType: pulumi.String("gwlb"),
    			ServiceId:    activeVpcEndpointService.ID().ToIDOutput().ToStringOutput(),
    			ZoneId:       pulumi.String(zoneId1),
    			DryRun:       pulumi.Bool(false),
    		})
    		if err != nil {
    			return err
    		}
    		activeVpcEndpoint, err := privatelink.NewVpcEndpoint(ctx, "active", &privatelink.VpcEndpointArgs{
    			ServiceId:       activeVpcEndpointService.ID().ToIDOutput().ToStringOutput(),
    			VpcEndpointName: pulumi.Sprintf("%v-ep-active", name),
    			VpcId:           _default.ID().ToIDOutput().ToStringOutput(),
    			ServiceName:     activeVpcEndpointService.VpcEndpointServiceName,
    			EndpointType:    pulumi.String("GatewayLoadBalancer"),
    		})
    		if err != nil {
    			return err
    		}
    		// Attach zone A to the GWLB endpoint. The route target group backend looks up
    		// the member endpoint by zone, so the endpoint must carry a non-empty zone.
    		_, err = privatelink.NewVpcEndpointZone(ctx, "active", &privatelink.VpcEndpointZoneArgs{
    			EndpointId: activeVpcEndpoint.ID().ToIDOutput().ToStringOutput(),
    			VswitchId:  zoneA.ID().ToIDOutput().ToStringOutput(),
    		})
    		if err != nil {
    			return err
    		}
    		// Standby member (zone B): identical chain in a different zone so the two
    		// members satisfy active-standby's two-different-zone rule.
    		standby, err := gwlb.NewLoadBalancer(ctx, "standby", &gwlb.LoadBalancerArgs{
    			LoadBalancerName: pulumi.Sprintf("%v-gwlb-standby", name),
    			AddressIpVersion: pulumi.String("Ipv4"),
    			VpcId:            _default.ID().ToIDOutput().ToStringOutput(),
    			ZoneMappings: gwlb.LoadBalancerZoneMappingArray{
    				&gwlb.LoadBalancerZoneMappingArgs{
    					VswitchId: zoneB.ID().ToIDOutput().ToStringOutput(),
    					ZoneId:    pulumi.String(zoneId2),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		standbyVpcEndpointService, err := privatelink.NewVpcEndpointService(ctx, "standby", &privatelink.VpcEndpointServiceArgs{
    			AutoAcceptConnection: pulumi.Bool(true),
    			ServiceDescription:   pulumi.Sprintf("%v-eps-standby", name),
    			ServiceResourceType:  pulumi.String("gwlb"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = privatelink.NewVpcEndpointServiceResource(ctx, "standby", &privatelink.VpcEndpointServiceResourceArgs{
    			ResourceId:   standby.ID().ToIDOutput().ToStringOutput(),
    			ResourceType: pulumi.String("gwlb"),
    			ServiceId:    standbyVpcEndpointService.ID().ToIDOutput().ToStringOutput(),
    			ZoneId:       pulumi.String(zoneId2),
    			DryRun:       pulumi.Bool(false),
    		})
    		if err != nil {
    			return err
    		}
    		standbyVpcEndpoint, err := privatelink.NewVpcEndpoint(ctx, "standby", &privatelink.VpcEndpointArgs{
    			ServiceId:       standbyVpcEndpointService.ID().ToIDOutput().ToStringOutput(),
    			VpcEndpointName: pulumi.Sprintf("%v-ep-standby", name),
    			VpcId:           _default.ID().ToIDOutput().ToStringOutput(),
    			ServiceName:     standbyVpcEndpointService.VpcEndpointServiceName,
    			EndpointType:    pulumi.String("GatewayLoadBalancer"),
    		})
    		if err != nil {
    			return err
    		}
    		// Attach zone B to the standby GWLB endpoint (different zone from active).
    		_, err = privatelink.NewVpcEndpointZone(ctx, "standby", &privatelink.VpcEndpointZoneArgs{
    			EndpointId: standbyVpcEndpoint.ID().ToIDOutput().ToStringOutput(),
    			VswitchId:  zoneB.ID().ToIDOutput().ToStringOutput(),
    		})
    		if err != nil {
    			return err
    		}
    		// The route target group depends_on both endpoint zones: the backend looks up
    		// each member endpoint by zone, so the zones must exist before Create is called.
    		_, err = vpc.NewRouteTargetGroup(ctx, "default", &vpc.RouteTargetGroupArgs{
    			RouteTargetGroupName:        pulumi.String(name),
    			RouteTargetGroupDescription: pulumi.String(name),
    			VpcId:                       _default.ID().ToIDOutput().ToStringOutput(),
    			ConfigMode:                  pulumi.String("Active-Standby"),
    			RouteTargetMemberLists: vpc.RouteTargetGroupRouteTargetMemberListArray{
    				&vpc.RouteTargetGroupRouteTargetMemberListArgs{
    					MemberId:   activeVpcEndpoint.ID().ToIDOutput().ToStringOutput(),
    					MemberType: pulumi.String("GatewayLoadBalancerEndpoint"),
    					Weight:     pulumi.Int(100),
    				},
    				&vpc.RouteTargetGroupRouteTargetMemberListArgs{
    					MemberId:   standbyVpcEndpoint.ID().ToIDOutput().ToStringOutput(),
    					MemberType: pulumi.String("GatewayLoadBalancerEndpoint"),
    					Weight:     pulumi.Int(0),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "terraform-example";
        var region = config.Get("region") ?? "cn-wulanchabu";
        var zoneId1 = config.Get("zoneId1") ?? "cn-wulanchabu-b";
        var zoneId2 = config.Get("zoneId2") ?? "cn-wulanchabu-c";
        var @default = new AliCloud.Vpc.Network("default", new()
        {
            VpcName = name,
            CidrBlock = "192.168.0.0/16",
        });
    
        var zoneA = new AliCloud.Vpc.Switch("zone_a", new()
        {
            VpcId = @default.Id,
            ZoneId = zoneId1,
            CidrBlock = "192.168.0.0/24",
        });
    
        var zoneB = new AliCloud.Vpc.Switch("zone_b", new()
        {
            VpcId = @default.Id,
            ZoneId = zoneId2,
            CidrBlock = "192.168.1.0/24",
        });
    
        // Active member (zone A): GWLB load balancer + GWLB-type endpoint service +
        // service-resource attachment + GatewayLoadBalancer endpoint. The endpoint
        // depends_on the service-resource so the GWLB is attached to the service
        // before the endpoint is created.
        var active = new AliCloud.Gwlb.LoadBalancer("active", new()
        {
            LoadBalancerName = $"{name}-gwlb-active",
            AddressIpVersion = "Ipv4",
            VpcId = @default.Id,
            ZoneMappings = new[]
            {
                new AliCloud.Gwlb.Inputs.LoadBalancerZoneMappingArgs
                {
                    VswitchId = zoneA.Id,
                    ZoneId = zoneId1,
                },
            },
        });
    
        var activeVpcEndpointService = new AliCloud.PrivateLink.VpcEndpointService("active", new()
        {
            AutoAcceptConnection = true,
            ServiceDescription = $"{name}-eps-active",
            ServiceResourceType = "gwlb",
        });
    
        var activeVpcEndpointServiceResource = new AliCloud.PrivateLink.VpcEndpointServiceResource("active", new()
        {
            ResourceId = active.Id,
            ResourceType = "gwlb",
            ServiceId = activeVpcEndpointService.Id,
            ZoneId = zoneId1,
            DryRun = false,
        });
    
        var activeVpcEndpoint = new AliCloud.PrivateLink.VpcEndpoint("active", new()
        {
            ServiceId = activeVpcEndpointService.Id,
            VpcEndpointName = $"{name}-ep-active",
            VpcId = @default.Id,
            ServiceName = activeVpcEndpointService.VpcEndpointServiceName,
            EndpointType = "GatewayLoadBalancer",
        });
    
        // Attach zone A to the GWLB endpoint. The route target group backend looks up
        // the member endpoint by zone, so the endpoint must carry a non-empty zone.
        var activeVpcEndpointZone = new AliCloud.PrivateLink.VpcEndpointZone("active", new()
        {
            EndpointId = activeVpcEndpoint.Id,
            VswitchId = zoneA.Id,
        });
    
        // Standby member (zone B): identical chain in a different zone so the two
        // members satisfy active-standby's two-different-zone rule.
        var standby = new AliCloud.Gwlb.LoadBalancer("standby", new()
        {
            LoadBalancerName = $"{name}-gwlb-standby",
            AddressIpVersion = "Ipv4",
            VpcId = @default.Id,
            ZoneMappings = new[]
            {
                new AliCloud.Gwlb.Inputs.LoadBalancerZoneMappingArgs
                {
                    VswitchId = zoneB.Id,
                    ZoneId = zoneId2,
                },
            },
        });
    
        var standbyVpcEndpointService = new AliCloud.PrivateLink.VpcEndpointService("standby", new()
        {
            AutoAcceptConnection = true,
            ServiceDescription = $"{name}-eps-standby",
            ServiceResourceType = "gwlb",
        });
    
        var standbyVpcEndpointServiceResource = new AliCloud.PrivateLink.VpcEndpointServiceResource("standby", new()
        {
            ResourceId = standby.Id,
            ResourceType = "gwlb",
            ServiceId = standbyVpcEndpointService.Id,
            ZoneId = zoneId2,
            DryRun = false,
        });
    
        var standbyVpcEndpoint = new AliCloud.PrivateLink.VpcEndpoint("standby", new()
        {
            ServiceId = standbyVpcEndpointService.Id,
            VpcEndpointName = $"{name}-ep-standby",
            VpcId = @default.Id,
            ServiceName = standbyVpcEndpointService.VpcEndpointServiceName,
            EndpointType = "GatewayLoadBalancer",
        });
    
        // Attach zone B to the standby GWLB endpoint (different zone from active).
        var standbyVpcEndpointZone = new AliCloud.PrivateLink.VpcEndpointZone("standby", new()
        {
            EndpointId = standbyVpcEndpoint.Id,
            VswitchId = zoneB.Id,
        });
    
        // The route target group depends_on both endpoint zones: the backend looks up
        // each member endpoint by zone, so the zones must exist before Create is called.
        var defaultRouteTargetGroup = new AliCloud.Vpc.RouteTargetGroup("default", new()
        {
            RouteTargetGroupName = name,
            RouteTargetGroupDescription = name,
            VpcId = @default.Id,
            ConfigMode = "Active-Standby",
            RouteTargetMemberLists = new[]
            {
                new AliCloud.Vpc.Inputs.RouteTargetGroupRouteTargetMemberListArgs
                {
                    MemberId = activeVpcEndpoint.Id,
                    MemberType = "GatewayLoadBalancerEndpoint",
                    Weight = 100,
                },
                new AliCloud.Vpc.Inputs.RouteTargetGroupRouteTargetMemberListArgs
                {
                    MemberId = standbyVpcEndpoint.Id,
                    MemberType = "GatewayLoadBalancerEndpoint",
                    Weight = 0,
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.vpc.Network;
    import com.pulumi.alicloud.vpc.NetworkArgs;
    import com.pulumi.alicloud.vpc.Switch;
    import com.pulumi.alicloud.vpc.SwitchArgs;
    import com.pulumi.alicloud.gwlb.LoadBalancer;
    import com.pulumi.alicloud.gwlb.LoadBalancerArgs;
    import com.pulumi.alicloud.gwlb.inputs.LoadBalancerZoneMappingArgs;
    import com.pulumi.alicloud.privatelink.VpcEndpointService;
    import com.pulumi.alicloud.privatelink.VpcEndpointServiceArgs;
    import com.pulumi.alicloud.privatelink.VpcEndpointServiceResource;
    import com.pulumi.alicloud.privatelink.VpcEndpointServiceResourceArgs;
    import com.pulumi.alicloud.privatelink.VpcEndpoint;
    import com.pulumi.alicloud.privatelink.VpcEndpointArgs;
    import com.pulumi.alicloud.privatelink.VpcEndpointZone;
    import com.pulumi.alicloud.privatelink.VpcEndpointZoneArgs;
    import com.pulumi.alicloud.vpc.RouteTargetGroup;
    import com.pulumi.alicloud.vpc.RouteTargetGroupArgs;
    import com.pulumi.alicloud.vpc.inputs.RouteTargetGroupRouteTargetMemberListArgs;
    import java.util.ArrayList;
    import java.util.Arrays;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var config = ctx.config();
            final var name = config.get("name").orElse("terraform-example");
            final var region = config.get("region").orElse("cn-wulanchabu");
            final var zoneId1 = config.get("zoneId1").orElse("cn-wulanchabu-b");
            final var zoneId2 = config.get("zoneId2").orElse("cn-wulanchabu-c");
            var default_ = new Network("default", NetworkArgs.builder()
                .vpcName(name)
                .cidrBlock("192.168.0.0/16")
                .build());
    
            var zoneA = new Switch("zoneA", SwitchArgs.builder()
                .vpcId(default_.id())
                .zoneId(zoneId1)
                .cidrBlock("192.168.0.0/24")
                .build());
    
            var zoneB = new Switch("zoneB", SwitchArgs.builder()
                .vpcId(default_.id())
                .zoneId(zoneId2)
                .cidrBlock("192.168.1.0/24")
                .build());
    
            // Active member (zone A): GWLB load balancer + GWLB-type endpoint service +
            // service-resource attachment + GatewayLoadBalancer endpoint. The endpoint
            // depends_on the service-resource so the GWLB is attached to the service
            // before the endpoint is created.
            var active = new LoadBalancer("active", LoadBalancerArgs.builder()
                .loadBalancerName(String.format("%s-gwlb-active", name))
                .addressIpVersion("Ipv4")
                .vpcId(default_.id())
                .zoneMappings(LoadBalancerZoneMappingArgs.builder()
                    .vswitchId(zoneA.id())
                    .zoneId(zoneId1)
                    .build())
                .build());
    
            var activeVpcEndpointService = new VpcEndpointService("activeVpcEndpointService", VpcEndpointServiceArgs.builder()
                .autoAcceptConnection(true)
                .serviceDescription(String.format("%s-eps-active", name))
                .serviceResourceType("gwlb")
                .build());
    
            var activeVpcEndpointServiceResource = new VpcEndpointServiceResource("activeVpcEndpointServiceResource", VpcEndpointServiceResourceArgs.builder()
                .resourceId(active.id())
                .resourceType("gwlb")
                .serviceId(activeVpcEndpointService.id())
                .zoneId(zoneId1)
                .dryRun(false)
                .build());
    
            var activeVpcEndpoint = new VpcEndpoint("activeVpcEndpoint", VpcEndpointArgs.builder()
                .serviceId(activeVpcEndpointService.id())
                .vpcEndpointName(String.format("%s-ep-active", name))
                .vpcId(default_.id())
                .serviceName(activeVpcEndpointService.vpcEndpointServiceName())
                .endpointType("GatewayLoadBalancer")
                .build());
    
            // Attach zone A to the GWLB endpoint. The route target group backend looks up
            // the member endpoint by zone, so the endpoint must carry a non-empty zone.
            var activeVpcEndpointZone = new VpcEndpointZone("activeVpcEndpointZone", VpcEndpointZoneArgs.builder()
                .endpointId(activeVpcEndpoint.id())
                .vswitchId(zoneA.id())
                .build());
    
            // Standby member (zone B): identical chain in a different zone so the two
            // members satisfy active-standby's two-different-zone rule.
            var standby = new LoadBalancer("standby", LoadBalancerArgs.builder()
                .loadBalancerName(String.format("%s-gwlb-standby", name))
                .addressIpVersion("Ipv4")
                .vpcId(default_.id())
                .zoneMappings(LoadBalancerZoneMappingArgs.builder()
                    .vswitchId(zoneB.id())
                    .zoneId(zoneId2)
                    .build())
                .build());
    
            var standbyVpcEndpointService = new VpcEndpointService("standbyVpcEndpointService", VpcEndpointServiceArgs.builder()
                .autoAcceptConnection(true)
                .serviceDescription(String.format("%s-eps-standby", name))
                .serviceResourceType("gwlb")
                .build());
    
            var standbyVpcEndpointServiceResource = new VpcEndpointServiceResource("standbyVpcEndpointServiceResource", VpcEndpointServiceResourceArgs.builder()
                .resourceId(standby.id())
                .resourceType("gwlb")
                .serviceId(standbyVpcEndpointService.id())
                .zoneId(zoneId2)
                .dryRun(false)
                .build());
    
            var standbyVpcEndpoint = new VpcEndpoint("standbyVpcEndpoint", VpcEndpointArgs.builder()
                .serviceId(standbyVpcEndpointService.id())
                .vpcEndpointName(String.format("%s-ep-standby", name))
                .vpcId(default_.id())
                .serviceName(standbyVpcEndpointService.vpcEndpointServiceName())
                .endpointType("GatewayLoadBalancer")
                .build());
    
            // Attach zone B to the standby GWLB endpoint (different zone from active).
            var standbyVpcEndpointZone = new VpcEndpointZone("standbyVpcEndpointZone", VpcEndpointZoneArgs.builder()
                .endpointId(standbyVpcEndpoint.id())
                .vswitchId(zoneB.id())
                .build());
    
            // The route target group depends_on both endpoint zones: the backend looks up
            // each member endpoint by zone, so the zones must exist before Create is called.
            var defaultRouteTargetGroup = new RouteTargetGroup("defaultRouteTargetGroup", RouteTargetGroupArgs.builder()
                .routeTargetGroupName(name)
                .routeTargetGroupDescription(name)
                .vpcId(default_.id())
                .configMode("Active-Standby")
                .routeTargetMemberLists(            
                    RouteTargetGroupRouteTargetMemberListArgs.builder()
                        .memberId(activeVpcEndpoint.id())
                        .memberType("GatewayLoadBalancerEndpoint")
                        .weight(100)
                        .build(),
                    RouteTargetGroupRouteTargetMemberListArgs.builder()
                        .memberId(standbyVpcEndpoint.id())
                        .memberType("GatewayLoadBalancerEndpoint")
                        .weight(0)
                        .build())
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: terraform-example
      region:
        type: string
        default: cn-wulanchabu
      zoneId1:
        type: string
        default: cn-wulanchabu-b
      zoneId2:
        type: string
        default: cn-wulanchabu-c
    resources:
      default:
        type: alicloud:vpc:Network
        properties:
          vpcName: ${name}
          cidrBlock: 192.168.0.0/16
      zoneA:
        type: alicloud:vpc:Switch
        name: zone_a
        properties:
          vpcId: ${default.id}
          zoneId: ${zoneId1}
          cidrBlock: 192.168.0.0/24
      zoneB:
        type: alicloud:vpc:Switch
        name: zone_b
        properties:
          vpcId: ${default.id}
          zoneId: ${zoneId2}
          cidrBlock: 192.168.1.0/24
      # Active member (zone A): GWLB load balancer + GWLB-type endpoint service +
      # service-resource attachment + GatewayLoadBalancer endpoint. The endpoint
      # depends_on the service-resource so the GWLB is attached to the service
      # before the endpoint is created.
      active:
        type: alicloud:gwlb:LoadBalancer
        properties:
          loadBalancerName: ${name}-gwlb-active
          addressIpVersion: Ipv4
          vpcId: ${default.id}
          zoneMappings:
            - vswitchId: ${zoneA.id}
              zoneId: ${zoneId1}
      activeVpcEndpointService:
        type: alicloud:privatelink:VpcEndpointService
        name: active
        properties:
          autoAcceptConnection: true
          serviceDescription: ${name}-eps-active
          serviceResourceType: gwlb
      activeVpcEndpointServiceResource:
        type: alicloud:privatelink:VpcEndpointServiceResource
        name: active
        properties:
          resourceId: ${active.id}
          resourceType: gwlb
          serviceId: ${activeVpcEndpointService.id}
          zoneId: ${zoneId1}
          dryRun: 'false'
      activeVpcEndpoint:
        type: alicloud:privatelink:VpcEndpoint
        name: active
        properties:
          serviceId: ${activeVpcEndpointService.id}
          vpcEndpointName: ${name}-ep-active
          vpcId: ${default.id}
          serviceName: ${activeVpcEndpointService.vpcEndpointServiceName}
          endpointType: GatewayLoadBalancer
      # Attach zone A to the GWLB endpoint. The route target group backend looks up
      # the member endpoint by zone, so the endpoint must carry a non-empty zone.
      activeVpcEndpointZone:
        type: alicloud:privatelink:VpcEndpointZone
        name: active
        properties:
          endpointId: ${activeVpcEndpoint.id}
          vswitchId: ${zoneA.id}
      # Standby member (zone B): identical chain in a different zone so the two
      # members satisfy active-standby's two-different-zone rule.
      standby:
        type: alicloud:gwlb:LoadBalancer
        properties:
          loadBalancerName: ${name}-gwlb-standby
          addressIpVersion: Ipv4
          vpcId: ${default.id}
          zoneMappings:
            - vswitchId: ${zoneB.id}
              zoneId: ${zoneId2}
      standbyVpcEndpointService:
        type: alicloud:privatelink:VpcEndpointService
        name: standby
        properties:
          autoAcceptConnection: true
          serviceDescription: ${name}-eps-standby
          serviceResourceType: gwlb
      standbyVpcEndpointServiceResource:
        type: alicloud:privatelink:VpcEndpointServiceResource
        name: standby
        properties:
          resourceId: ${standby.id}
          resourceType: gwlb
          serviceId: ${standbyVpcEndpointService.id}
          zoneId: ${zoneId2}
          dryRun: 'false'
      standbyVpcEndpoint:
        type: alicloud:privatelink:VpcEndpoint
        name: standby
        properties:
          serviceId: ${standbyVpcEndpointService.id}
          vpcEndpointName: ${name}-ep-standby
          vpcId: ${default.id}
          serviceName: ${standbyVpcEndpointService.vpcEndpointServiceName}
          endpointType: GatewayLoadBalancer
      # Attach zone B to the standby GWLB endpoint (different zone from active).
      standbyVpcEndpointZone:
        type: alicloud:privatelink:VpcEndpointZone
        name: standby
        properties:
          endpointId: ${standbyVpcEndpoint.id}
          vswitchId: ${zoneB.id}
      # The route target group depends_on both endpoint zones: the backend looks up
      # each member endpoint by zone, so the zones must exist before Create is called.
      defaultRouteTargetGroup:
        type: alicloud:vpc:RouteTargetGroup
        name: default
        properties:
          routeTargetGroupName: ${name}
          routeTargetGroupDescription: ${name}
          vpcId: ${default.id}
          configMode: Active-Standby
          routeTargetMemberLists:
            - memberId: ${activeVpcEndpoint.id}
              memberType: GatewayLoadBalancerEndpoint
              weight: 100
            - memberId: ${standbyVpcEndpoint.id}
              memberType: GatewayLoadBalancerEndpoint
              weight: 0
    
    pulumi {
      required_providers {
        alicloud = {
          source = "pulumi/alicloud"
        }
      }
    }
    
    resource "alicloud_vpc_network" "default" {
      vpc_name   = var.name
      cidr_block = "192.168.0.0/16"
    }
    resource "alicloud_vpc_switch" "zone_a" {
      vpc_id     = alicloud_vpc_network.default.id
      zone_id    = var.zoneId1
      cidr_block = "192.168.0.0/24"
    }
    resource "alicloud_vpc_switch" "zone_b" {
      vpc_id     = alicloud_vpc_network.default.id
      zone_id    = var.zoneId2
      cidr_block = "192.168.1.0/24"
    }
    # Active member (zone A): GWLB load balancer + GWLB-type endpoint service +
    # service-resource attachment + GatewayLoadBalancer endpoint. The endpoint
    # depends_on the service-resource so the GWLB is attached to the service
    # before the endpoint is created.
    resource "alicloud_gwlb_loadbalancer" "active" {
      load_balancer_name ="${var.name}-gwlb-active"
      address_ip_version = "Ipv4"
      vpc_id             = alicloud_vpc_network.default.id
      zone_mappings {
        vswitch_id = alicloud_vpc_switch.zone_a.id
        zone_id    = var.zoneId1
      }
    }
    resource "alicloud_privatelink_vpcendpointservice" "active" {
      auto_accept_connection = true
      service_description    ="${var.name}-eps-active"
      service_resource_type  = "gwlb"
    }
    resource "alicloud_privatelink_vpcendpointserviceresource" "active" {
      resource_id   = alicloud_gwlb_loadbalancer.active.id
      resource_type = "gwlb"
      service_id    = alicloud_privatelink_vpcendpointservice.active.id
      zone_id       = var.zoneId1
      dry_run       = "false"
    }
    resource "alicloud_privatelink_vpcendpoint" "active" {
      service_id        = alicloud_privatelink_vpcendpointservice.active.id
      vpc_endpoint_name ="${var.name}-ep-active"
      vpc_id            = alicloud_vpc_network.default.id
      service_name      = alicloud_privatelink_vpcendpointservice.active.vpc_endpoint_service_name
      endpoint_type     = "GatewayLoadBalancer"
    }
    # Attach zone A to the GWLB endpoint. The route target group backend looks up
    # the member endpoint by zone, so the endpoint must carry a non-empty zone.
    resource "alicloud_privatelink_vpcendpointzone" "active" {
      endpoint_id = alicloud_privatelink_vpcendpoint.active.id
      vswitch_id  = alicloud_vpc_switch.zone_a.id
    }
    # Standby member (zone B): identical chain in a different zone so the two
    # members satisfy active-standby's two-different-zone rule.
    resource "alicloud_gwlb_loadbalancer" "standby" {
      load_balancer_name ="${var.name}-gwlb-standby"
      address_ip_version = "Ipv4"
      vpc_id             = alicloud_vpc_network.default.id
      zone_mappings {
        vswitch_id = alicloud_vpc_switch.zone_b.id
        zone_id    = var.zoneId2
      }
    }
    resource "alicloud_privatelink_vpcendpointservice" "standby" {
      auto_accept_connection = true
      service_description    ="${var.name}-eps-standby"
      service_resource_type  = "gwlb"
    }
    resource "alicloud_privatelink_vpcendpointserviceresource" "standby" {
      resource_id   = alicloud_gwlb_loadbalancer.standby.id
      resource_type = "gwlb"
      service_id    = alicloud_privatelink_vpcendpointservice.standby.id
      zone_id       = var.zoneId2
      dry_run       = "false"
    }
    resource "alicloud_privatelink_vpcendpoint" "standby" {
      service_id        = alicloud_privatelink_vpcendpointservice.standby.id
      vpc_endpoint_name ="${var.name}-ep-standby"
      vpc_id            = alicloud_vpc_network.default.id
      service_name      = alicloud_privatelink_vpcendpointservice.standby.vpc_endpoint_service_name
      endpoint_type     = "GatewayLoadBalancer"
    }
    # Attach zone B to the standby GWLB endpoint (different zone from active).
    resource "alicloud_privatelink_vpcendpointzone" "standby" {
      endpoint_id = alicloud_privatelink_vpcendpoint.standby.id
      vswitch_id  = alicloud_vpc_switch.zone_b.id
    }
    # The route target group depends_on both endpoint zones: the backend looks up
    # each member endpoint by zone, so the zones must exist before Create is called.
    resource "alicloud_vpc_routetargetgroup" "default" {
      route_target_group_name        = var.name
      route_target_group_description = var.name
      vpc_id                         = alicloud_vpc_network.default.id
      config_mode                    = "Active-Standby"
      route_target_member_lists {
        member_id   = alicloud_privatelink_vpcendpoint.active.id
        member_type = "GatewayLoadBalancerEndpoint"
        weight      = 100
      }
      route_target_member_lists {
        member_id   = alicloud_privatelink_vpcendpoint.standby.id
        member_type = "GatewayLoadBalancerEndpoint"
        weight      = 0
      }
    }
    variable "name" {
      type    = string
      default = "terraform-example"
    }
    variable "region" {
      type    = string
      default = "cn-wulanchabu"
    }
    variable "zoneId1" {
      type    = string
      default = "cn-wulanchabu-b"
    }
    variable "zoneId2" {
      type    = string
      default = "cn-wulanchabu-c"
    }
    

    📚 Need more examples? VIEW MORE EXAMPLES

    Create RouteTargetGroup Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new RouteTargetGroup(name: string, args: RouteTargetGroupArgs, opts?: CustomResourceOptions);
    @overload
    def RouteTargetGroup(resource_name: str,
                         args: RouteTargetGroupArgs,
                         opts: Optional[ResourceOptions] = None)
    
    @overload
    def RouteTargetGroup(resource_name: str,
                         opts: Optional[ResourceOptions] = None,
                         config_mode: Optional[str] = None,
                         route_target_member_lists: Optional[Sequence[RouteTargetGroupRouteTargetMemberListArgs]] = None,
                         vpc_id: Optional[str] = None,
                         resource_group_id: Optional[str] = None,
                         route_target_group_description: Optional[str] = None,
                         route_target_group_name: Optional[str] = None,
                         tags: Optional[Mapping[str, str]] = None)
    func NewRouteTargetGroup(ctx *Context, name string, args RouteTargetGroupArgs, opts ...ResourceOption) (*RouteTargetGroup, error)
    public RouteTargetGroup(string name, RouteTargetGroupArgs args, CustomResourceOptions? opts = null)
    public RouteTargetGroup(String name, RouteTargetGroupArgs args)
    public RouteTargetGroup(String name, RouteTargetGroupArgs args, CustomResourceOptions options)
    
    type: alicloud:vpc:RouteTargetGroup
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    resource "alicloud_vpc_route_target_group" "name" {
        # resource properties
    }

    Parameters

    name string
    The unique name of the resource.
    args RouteTargetGroupArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args RouteTargetGroupArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args RouteTargetGroupArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args RouteTargetGroupArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args RouteTargetGroupArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var routeTargetGroupResource = new AliCloud.Vpc.RouteTargetGroup("routeTargetGroupResource", new()
    {
        ConfigMode = "string",
        RouteTargetMemberLists = new[]
        {
            new AliCloud.Vpc.Inputs.RouteTargetGroupRouteTargetMemberListArgs
            {
                MemberId = "string",
                MemberType = "string",
                Weight = 0,
                EnableStatus = "string",
                HealthCheckStatus = "string",
            },
        },
        VpcId = "string",
        ResourceGroupId = "string",
        RouteTargetGroupDescription = "string",
        RouteTargetGroupName = "string",
        Tags = 
        {
            { "string", "string" },
        },
    });
    
    example, err := vpc.NewRouteTargetGroup(ctx, "routeTargetGroupResource", &vpc.RouteTargetGroupArgs{
    	ConfigMode: pulumi.String("string"),
    	RouteTargetMemberLists: vpc.RouteTargetGroupRouteTargetMemberListArray{
    		&vpc.RouteTargetGroupRouteTargetMemberListArgs{
    			MemberId:          pulumi.String("string"),
    			MemberType:        pulumi.String("string"),
    			Weight:            pulumi.Int(0),
    			EnableStatus:      pulumi.String("string"),
    			HealthCheckStatus: pulumi.String("string"),
    		},
    	},
    	VpcId:                       pulumi.String("string"),
    	ResourceGroupId:             pulumi.String("string"),
    	RouteTargetGroupDescription: pulumi.String("string"),
    	RouteTargetGroupName:        pulumi.String("string"),
    	Tags: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    })
    
    resource "alicloud_vpc_route_target_group" "routeTargetGroupResource" {
      lifecycle {
        create_before_destroy = true
      }
      config_mode = "string"
      route_target_member_lists {
        member_id           = "string"
        member_type         = "string"
        weight              = 0
        enable_status       = "string"
        health_check_status = "string"
      }
      vpc_id                         = "string"
      resource_group_id              = "string"
      route_target_group_description = "string"
      route_target_group_name        = "string"
      tags = {
        "string" = "string"
      }
    }
    
    var routeTargetGroupResource = new RouteTargetGroup("routeTargetGroupResource", RouteTargetGroupArgs.builder()
        .configMode("string")
        .routeTargetMemberLists(RouteTargetGroupRouteTargetMemberListArgs.builder()
            .memberId("string")
            .memberType("string")
            .weight(0)
            .enableStatus("string")
            .healthCheckStatus("string")
            .build())
        .vpcId("string")
        .resourceGroupId("string")
        .routeTargetGroupDescription("string")
        .routeTargetGroupName("string")
        .tags(Map.of("string", "string"))
        .build());
    
    route_target_group_resource = alicloud.vpc.RouteTargetGroup("routeTargetGroupResource",
        config_mode="string",
        route_target_member_lists=[{
            "member_id": "string",
            "member_type": "string",
            "weight": 0,
            "enable_status": "string",
            "health_check_status": "string",
        }],
        vpc_id="string",
        resource_group_id="string",
        route_target_group_description="string",
        route_target_group_name="string",
        tags={
            "string": "string",
        })
    
    const routeTargetGroupResource = new alicloud.vpc.RouteTargetGroup("routeTargetGroupResource", {
        configMode: "string",
        routeTargetMemberLists: [{
            memberId: "string",
            memberType: "string",
            weight: 0,
            enableStatus: "string",
            healthCheckStatus: "string",
        }],
        vpcId: "string",
        resourceGroupId: "string",
        routeTargetGroupDescription: "string",
        routeTargetGroupName: "string",
        tags: {
            string: "string",
        },
    });
    
    type: alicloud:vpc:RouteTargetGroup
    properties:
        configMode: string
        resourceGroupId: string
        routeTargetGroupDescription: string
        routeTargetGroupName: string
        routeTargetMemberLists:
            - enableStatus: string
              healthCheckStatus: string
              memberId: string
              memberType: string
              weight: 0
        tags:
            string: string
        vpcId: string
    

    RouteTargetGroup Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The RouteTargetGroup resource accepts the following input properties:

    ConfigMode string
    The configuration mode of the route target group. Supported modes include:

    • Active-Standby: active-standby mode.
    RouteTargetMemberLists List<Pulumi.AliCloud.Vpc.Inputs.RouteTargetGroupRouteTargetMemberList>
    The member list of the route target group. **Note: The parameter is immutable after resource creation. In active-standby mode, member weight and type cannot be changed via UpdateRouteTargetGroup; switching active/standby uses a separate SwitchActiveRouteTarget operation. In active/standby mode, the following restrictions apply to route target group members:

    1. The route target group must contain exactly two members.
    2. The route target group members must belong to different zones. See routeTargetMemberList below.
    VpcId string
    The ID of the VPC to which the route target group belongs.
    ResourceGroupId string
    The ID of the resource group to which the route target group belongs.
    RouteTargetGroupDescription string
    The description of the route target group. The description must be 1 to 256 characters in length and cannot start with http:// or https://.
    RouteTargetGroupName string
    The name of the route target group. The name must be 1 to 128 characters in length and cannot start with http:// or https://.
    Tags Dictionary<string, string>
    The tags of the route target group.
    ConfigMode string
    The configuration mode of the route target group. Supported modes include:

    • Active-Standby: active-standby mode.
    RouteTargetMemberLists []RouteTargetGroupRouteTargetMemberListArgs
    The member list of the route target group. **Note: The parameter is immutable after resource creation. In active-standby mode, member weight and type cannot be changed via UpdateRouteTargetGroup; switching active/standby uses a separate SwitchActiveRouteTarget operation. In active/standby mode, the following restrictions apply to route target group members:

    1. The route target group must contain exactly two members.
    2. The route target group members must belong to different zones. See routeTargetMemberList below.
    VpcId string
    The ID of the VPC to which the route target group belongs.
    ResourceGroupId string
    The ID of the resource group to which the route target group belongs.
    RouteTargetGroupDescription string
    The description of the route target group. The description must be 1 to 256 characters in length and cannot start with http:// or https://.
    RouteTargetGroupName string
    The name of the route target group. The name must be 1 to 128 characters in length and cannot start with http:// or https://.
    Tags map[string]string
    The tags of the route target group.
    config_mode string
    The configuration mode of the route target group. Supported modes include:

    • Active-Standby: active-standby mode.
    route_target_member_lists list(object)
    The member list of the route target group. **Note: The parameter is immutable after resource creation. In active-standby mode, member weight and type cannot be changed via UpdateRouteTargetGroup; switching active/standby uses a separate SwitchActiveRouteTarget operation. In active/standby mode, the following restrictions apply to route target group members:

    1. The route target group must contain exactly two members.
    2. The route target group members must belong to different zones. See routeTargetMemberList below.
    vpc_id string
    The ID of the VPC to which the route target group belongs.
    resource_group_id string
    The ID of the resource group to which the route target group belongs.
    route_target_group_description string
    The description of the route target group. The description must be 1 to 256 characters in length and cannot start with http:// or https://.
    route_target_group_name string
    The name of the route target group. The name must be 1 to 128 characters in length and cannot start with http:// or https://.
    tags map(string)
    The tags of the route target group.
    configMode String
    The configuration mode of the route target group. Supported modes include:

    • Active-Standby: active-standby mode.
    routeTargetMemberLists List<RouteTargetGroupRouteTargetMemberList>
    The member list of the route target group. **Note: The parameter is immutable after resource creation. In active-standby mode, member weight and type cannot be changed via UpdateRouteTargetGroup; switching active/standby uses a separate SwitchActiveRouteTarget operation. In active/standby mode, the following restrictions apply to route target group members:

    1. The route target group must contain exactly two members.
    2. The route target group members must belong to different zones. See routeTargetMemberList below.
    vpcId String
    The ID of the VPC to which the route target group belongs.
    resourceGroupId String
    The ID of the resource group to which the route target group belongs.
    routeTargetGroupDescription String
    The description of the route target group. The description must be 1 to 256 characters in length and cannot start with http:// or https://.
    routeTargetGroupName String
    The name of the route target group. The name must be 1 to 128 characters in length and cannot start with http:// or https://.
    tags Map<String,String>
    The tags of the route target group.
    configMode string
    The configuration mode of the route target group. Supported modes include:

    • Active-Standby: active-standby mode.
    routeTargetMemberLists RouteTargetGroupRouteTargetMemberList[]
    The member list of the route target group. **Note: The parameter is immutable after resource creation. In active-standby mode, member weight and type cannot be changed via UpdateRouteTargetGroup; switching active/standby uses a separate SwitchActiveRouteTarget operation. In active/standby mode, the following restrictions apply to route target group members:

    1. The route target group must contain exactly two members.
    2. The route target group members must belong to different zones. See routeTargetMemberList below.
    vpcId string
    The ID of the VPC to which the route target group belongs.
    resourceGroupId string
    The ID of the resource group to which the route target group belongs.
    routeTargetGroupDescription string
    The description of the route target group. The description must be 1 to 256 characters in length and cannot start with http:// or https://.
    routeTargetGroupName string
    The name of the route target group. The name must be 1 to 128 characters in length and cannot start with http:// or https://.
    tags {[key: string]: string}
    The tags of the route target group.
    config_mode str
    The configuration mode of the route target group. Supported modes include:

    • Active-Standby: active-standby mode.
    route_target_member_lists Sequence[RouteTargetGroupRouteTargetMemberListArgs]
    The member list of the route target group. **Note: The parameter is immutable after resource creation. In active-standby mode, member weight and type cannot be changed via UpdateRouteTargetGroup; switching active/standby uses a separate SwitchActiveRouteTarget operation. In active/standby mode, the following restrictions apply to route target group members:

    1. The route target group must contain exactly two members.
    2. The route target group members must belong to different zones. See routeTargetMemberList below.
    vpc_id str
    The ID of the VPC to which the route target group belongs.
    resource_group_id str
    The ID of the resource group to which the route target group belongs.
    route_target_group_description str
    The description of the route target group. The description must be 1 to 256 characters in length and cannot start with http:// or https://.
    route_target_group_name str
    The name of the route target group. The name must be 1 to 128 characters in length and cannot start with http:// or https://.
    tags Mapping[str, str]
    The tags of the route target group.
    configMode String
    The configuration mode of the route target group. Supported modes include:

    • Active-Standby: active-standby mode.
    routeTargetMemberLists List<Property Map>
    The member list of the route target group. **Note: The parameter is immutable after resource creation. In active-standby mode, member weight and type cannot be changed via UpdateRouteTargetGroup; switching active/standby uses a separate SwitchActiveRouteTarget operation. In active/standby mode, the following restrictions apply to route target group members:

    1. The route target group must contain exactly two members.
    2. The route target group members must belong to different zones. See routeTargetMemberList below.
    vpcId String
    The ID of the VPC to which the route target group belongs.
    resourceGroupId String
    The ID of the resource group to which the route target group belongs.
    routeTargetGroupDescription String
    The description of the route target group. The description must be 1 to 256 characters in length and cannot start with http:// or https://.
    routeTargetGroupName String
    The name of the route target group. The name must be 1 to 128 characters in length and cannot start with http:// or https://.
    tags Map<String>
    The tags of the route target group.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the RouteTargetGroup resource produces the following output properties:

    CreateTime string
    The time when the route target group was created.
    Id string
    The provider-assigned unique ID for this managed resource.
    Status string
    The status of the route target group. Valid values: Pending, Available.
    CreateTime string
    The time when the route target group was created.
    Id string
    The provider-assigned unique ID for this managed resource.
    Status string
    The status of the route target group. Valid values: Pending, Available.
    create_time string
    The time when the route target group was created.
    id string
    The provider-assigned unique ID for this managed resource.
    status string
    The status of the route target group. Valid values: Pending, Available.
    createTime String
    The time when the route target group was created.
    id String
    The provider-assigned unique ID for this managed resource.
    status String
    The status of the route target group. Valid values: Pending, Available.
    createTime string
    The time when the route target group was created.
    id string
    The provider-assigned unique ID for this managed resource.
    status string
    The status of the route target group. Valid values: Pending, Available.
    create_time str
    The time when the route target group was created.
    id str
    The provider-assigned unique ID for this managed resource.
    status str
    The status of the route target group. Valid values: Pending, Available.
    createTime String
    The time when the route target group was created.
    id String
    The provider-assigned unique ID for this managed resource.
    status String
    The status of the route target group. Valid values: Pending, Available.

    Look up Existing RouteTargetGroup Resource

    Get an existing RouteTargetGroup resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: RouteTargetGroupState, opts?: CustomResourceOptions): RouteTargetGroup
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            config_mode: Optional[str] = None,
            create_time: Optional[str] = None,
            resource_group_id: Optional[str] = None,
            route_target_group_description: Optional[str] = None,
            route_target_group_name: Optional[str] = None,
            route_target_member_lists: Optional[Sequence[RouteTargetGroupRouteTargetMemberListArgs]] = None,
            status: Optional[str] = None,
            tags: Optional[Mapping[str, str]] = None,
            vpc_id: Optional[str] = None) -> RouteTargetGroup
    func GetRouteTargetGroup(ctx *Context, name string, id IDInput, state *RouteTargetGroupState, opts ...ResourceOption) (*RouteTargetGroup, error)
    public static RouteTargetGroup Get(string name, Input<string> id, RouteTargetGroupState? state, CustomResourceOptions? opts = null)
    public static RouteTargetGroup get(String name, Output<String> id, RouteTargetGroupState state, CustomResourceOptions options)
    resources:  _:    type: alicloud:vpc:RouteTargetGroup    get:      id: ${id}
    import {
      to = alicloud_vpc_route_target_group.example
      id = "${id}"
    }
    
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    ConfigMode string
    The configuration mode of the route target group. Supported modes include:

    • Active-Standby: active-standby mode.
    CreateTime string
    The time when the route target group was created.
    ResourceGroupId string
    The ID of the resource group to which the route target group belongs.
    RouteTargetGroupDescription string
    The description of the route target group. The description must be 1 to 256 characters in length and cannot start with http:// or https://.
    RouteTargetGroupName string
    The name of the route target group. The name must be 1 to 128 characters in length and cannot start with http:// or https://.
    RouteTargetMemberLists List<Pulumi.AliCloud.Vpc.Inputs.RouteTargetGroupRouteTargetMemberList>
    The member list of the route target group. **Note: The parameter is immutable after resource creation. In active-standby mode, member weight and type cannot be changed via UpdateRouteTargetGroup; switching active/standby uses a separate SwitchActiveRouteTarget operation. In active/standby mode, the following restrictions apply to route target group members:

    1. The route target group must contain exactly two members.
    2. The route target group members must belong to different zones. See routeTargetMemberList below.
    Status string
    The status of the route target group. Valid values: Pending, Available.
    Tags Dictionary<string, string>
    The tags of the route target group.
    VpcId string
    The ID of the VPC to which the route target group belongs.
    ConfigMode string
    The configuration mode of the route target group. Supported modes include:

    • Active-Standby: active-standby mode.
    CreateTime string
    The time when the route target group was created.
    ResourceGroupId string
    The ID of the resource group to which the route target group belongs.
    RouteTargetGroupDescription string
    The description of the route target group. The description must be 1 to 256 characters in length and cannot start with http:// or https://.
    RouteTargetGroupName string
    The name of the route target group. The name must be 1 to 128 characters in length and cannot start with http:// or https://.
    RouteTargetMemberLists []RouteTargetGroupRouteTargetMemberListArgs
    The member list of the route target group. **Note: The parameter is immutable after resource creation. In active-standby mode, member weight and type cannot be changed via UpdateRouteTargetGroup; switching active/standby uses a separate SwitchActiveRouteTarget operation. In active/standby mode, the following restrictions apply to route target group members:

    1. The route target group must contain exactly two members.
    2. The route target group members must belong to different zones. See routeTargetMemberList below.
    Status string
    The status of the route target group. Valid values: Pending, Available.
    Tags map[string]string
    The tags of the route target group.
    VpcId string
    The ID of the VPC to which the route target group belongs.
    config_mode string
    The configuration mode of the route target group. Supported modes include:

    • Active-Standby: active-standby mode.
    create_time string
    The time when the route target group was created.
    resource_group_id string
    The ID of the resource group to which the route target group belongs.
    route_target_group_description string
    The description of the route target group. The description must be 1 to 256 characters in length and cannot start with http:// or https://.
    route_target_group_name string
    The name of the route target group. The name must be 1 to 128 characters in length and cannot start with http:// or https://.
    route_target_member_lists list(object)
    The member list of the route target group. **Note: The parameter is immutable after resource creation. In active-standby mode, member weight and type cannot be changed via UpdateRouteTargetGroup; switching active/standby uses a separate SwitchActiveRouteTarget operation. In active/standby mode, the following restrictions apply to route target group members:

    1. The route target group must contain exactly two members.
    2. The route target group members must belong to different zones. See routeTargetMemberList below.
    status string
    The status of the route target group. Valid values: Pending, Available.
    tags map(string)
    The tags of the route target group.
    vpc_id string
    The ID of the VPC to which the route target group belongs.
    configMode String
    The configuration mode of the route target group. Supported modes include:

    • Active-Standby: active-standby mode.
    createTime String
    The time when the route target group was created.
    resourceGroupId String
    The ID of the resource group to which the route target group belongs.
    routeTargetGroupDescription String
    The description of the route target group. The description must be 1 to 256 characters in length and cannot start with http:// or https://.
    routeTargetGroupName String
    The name of the route target group. The name must be 1 to 128 characters in length and cannot start with http:// or https://.
    routeTargetMemberLists List<RouteTargetGroupRouteTargetMemberList>
    The member list of the route target group. **Note: The parameter is immutable after resource creation. In active-standby mode, member weight and type cannot be changed via UpdateRouteTargetGroup; switching active/standby uses a separate SwitchActiveRouteTarget operation. In active/standby mode, the following restrictions apply to route target group members:

    1. The route target group must contain exactly two members.
    2. The route target group members must belong to different zones. See routeTargetMemberList below.
    status String
    The status of the route target group. Valid values: Pending, Available.
    tags Map<String,String>
    The tags of the route target group.
    vpcId String
    The ID of the VPC to which the route target group belongs.
    configMode string
    The configuration mode of the route target group. Supported modes include:

    • Active-Standby: active-standby mode.
    createTime string
    The time when the route target group was created.
    resourceGroupId string
    The ID of the resource group to which the route target group belongs.
    routeTargetGroupDescription string
    The description of the route target group. The description must be 1 to 256 characters in length and cannot start with http:// or https://.
    routeTargetGroupName string
    The name of the route target group. The name must be 1 to 128 characters in length and cannot start with http:// or https://.
    routeTargetMemberLists RouteTargetGroupRouteTargetMemberList[]
    The member list of the route target group. **Note: The parameter is immutable after resource creation. In active-standby mode, member weight and type cannot be changed via UpdateRouteTargetGroup; switching active/standby uses a separate SwitchActiveRouteTarget operation. In active/standby mode, the following restrictions apply to route target group members:

    1. The route target group must contain exactly two members.
    2. The route target group members must belong to different zones. See routeTargetMemberList below.
    status string
    The status of the route target group. Valid values: Pending, Available.
    tags {[key: string]: string}
    The tags of the route target group.
    vpcId string
    The ID of the VPC to which the route target group belongs.
    config_mode str
    The configuration mode of the route target group. Supported modes include:

    • Active-Standby: active-standby mode.
    create_time str
    The time when the route target group was created.
    resource_group_id str
    The ID of the resource group to which the route target group belongs.
    route_target_group_description str
    The description of the route target group. The description must be 1 to 256 characters in length and cannot start with http:// or https://.
    route_target_group_name str
    The name of the route target group. The name must be 1 to 128 characters in length and cannot start with http:// or https://.
    route_target_member_lists Sequence[RouteTargetGroupRouteTargetMemberListArgs]
    The member list of the route target group. **Note: The parameter is immutable after resource creation. In active-standby mode, member weight and type cannot be changed via UpdateRouteTargetGroup; switching active/standby uses a separate SwitchActiveRouteTarget operation. In active/standby mode, the following restrictions apply to route target group members:

    1. The route target group must contain exactly two members.
    2. The route target group members must belong to different zones. See routeTargetMemberList below.
    status str
    The status of the route target group. Valid values: Pending, Available.
    tags Mapping[str, str]
    The tags of the route target group.
    vpc_id str
    The ID of the VPC to which the route target group belongs.
    configMode String
    The configuration mode of the route target group. Supported modes include:

    • Active-Standby: active-standby mode.
    createTime String
    The time when the route target group was created.
    resourceGroupId String
    The ID of the resource group to which the route target group belongs.
    routeTargetGroupDescription String
    The description of the route target group. The description must be 1 to 256 characters in length and cannot start with http:// or https://.
    routeTargetGroupName String
    The name of the route target group. The name must be 1 to 128 characters in length and cannot start with http:// or https://.
    routeTargetMemberLists List<Property Map>
    The member list of the route target group. **Note: The parameter is immutable after resource creation. In active-standby mode, member weight and type cannot be changed via UpdateRouteTargetGroup; switching active/standby uses a separate SwitchActiveRouteTarget operation. In active/standby mode, the following restrictions apply to route target group members:

    1. The route target group must contain exactly two members.
    2. The route target group members must belong to different zones. See routeTargetMemberList below.
    status String
    The status of the route target group. Valid values: Pending, Available.
    tags Map<String>
    The tags of the route target group.
    vpcId String
    The ID of the VPC to which the route target group belongs.

    Supporting Types

    RouteTargetGroupRouteTargetMemberList, RouteTargetGroupRouteTargetMemberListArgs

    MemberId string
    The instance ID of the route target member.
    MemberType string
    The instance type of the route target configuration. The following type is currently supported:

    • GatewayLoadBalancerEndpoint.
    Weight int

    Sets the weight attribute for the current route target configuration.

    In active-standby mode, the weight can only be set to 0 or 100:

    • Only one route target configuration can be set to 100, serving as the active instance.
    • Only one route target configuration can be set to 0, serving as the standby instance.
    EnableStatus string
    Indicates the enable status of the current route target configuration. Valid values: Enable, Disable.
    HealthCheckStatus string
    The health check status of the current route target configuration.
    MemberId string
    The instance ID of the route target member.
    MemberType string
    The instance type of the route target configuration. The following type is currently supported:

    • GatewayLoadBalancerEndpoint.
    Weight int

    Sets the weight attribute for the current route target configuration.

    In active-standby mode, the weight can only be set to 0 or 100:

    • Only one route target configuration can be set to 100, serving as the active instance.
    • Only one route target configuration can be set to 0, serving as the standby instance.
    EnableStatus string
    Indicates the enable status of the current route target configuration. Valid values: Enable, Disable.
    HealthCheckStatus string
    The health check status of the current route target configuration.
    member_id string
    The instance ID of the route target member.
    member_type string
    The instance type of the route target configuration. The following type is currently supported:

    • GatewayLoadBalancerEndpoint.
    weight number

    Sets the weight attribute for the current route target configuration.

    In active-standby mode, the weight can only be set to 0 or 100:

    • Only one route target configuration can be set to 100, serving as the active instance.
    • Only one route target configuration can be set to 0, serving as the standby instance.
    enable_status string
    Indicates the enable status of the current route target configuration. Valid values: Enable, Disable.
    health_check_status string
    The health check status of the current route target configuration.
    memberId String
    The instance ID of the route target member.
    memberType String
    The instance type of the route target configuration. The following type is currently supported:

    • GatewayLoadBalancerEndpoint.
    weight Integer

    Sets the weight attribute for the current route target configuration.

    In active-standby mode, the weight can only be set to 0 or 100:

    • Only one route target configuration can be set to 100, serving as the active instance.
    • Only one route target configuration can be set to 0, serving as the standby instance.
    enableStatus String
    Indicates the enable status of the current route target configuration. Valid values: Enable, Disable.
    healthCheckStatus String
    The health check status of the current route target configuration.
    memberId string
    The instance ID of the route target member.
    memberType string
    The instance type of the route target configuration. The following type is currently supported:

    • GatewayLoadBalancerEndpoint.
    weight number

    Sets the weight attribute for the current route target configuration.

    In active-standby mode, the weight can only be set to 0 or 100:

    • Only one route target configuration can be set to 100, serving as the active instance.
    • Only one route target configuration can be set to 0, serving as the standby instance.
    enableStatus string
    Indicates the enable status of the current route target configuration. Valid values: Enable, Disable.
    healthCheckStatus string
    The health check status of the current route target configuration.
    member_id str
    The instance ID of the route target member.
    member_type str
    The instance type of the route target configuration. The following type is currently supported:

    • GatewayLoadBalancerEndpoint.
    weight int

    Sets the weight attribute for the current route target configuration.

    In active-standby mode, the weight can only be set to 0 or 100:

    • Only one route target configuration can be set to 100, serving as the active instance.
    • Only one route target configuration can be set to 0, serving as the standby instance.
    enable_status str
    Indicates the enable status of the current route target configuration. Valid values: Enable, Disable.
    health_check_status str
    The health check status of the current route target configuration.
    memberId String
    The instance ID of the route target member.
    memberType String
    The instance type of the route target configuration. The following type is currently supported:

    • GatewayLoadBalancerEndpoint.
    weight Number

    Sets the weight attribute for the current route target configuration.

    In active-standby mode, the weight can only be set to 0 or 100:

    • Only one route target configuration can be set to 100, serving as the active instance.
    • Only one route target configuration can be set to 0, serving as the standby instance.
    enableStatus String
    Indicates the enable status of the current route target configuration. Valid values: Enable, Disable.
    healthCheckStatus String
    The health check status of the current route target configuration.

    Import

    VPC Route Target Group can be imported using the id, e.g.

    $ pulumi import alicloud:vpc/routeTargetGroup:RouteTargetGroup example <route_target_group_id>
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo alicloud logo
    Viewing docs for Alibaba Cloud v3.108.0
    published on Thursday, Sep 17, 2026 by Pulumi

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial