1. Packages
  2. Tencentcloud Provider
  3. API Docs
  4. ClbTargetGroupAttachments
tencentcloud 1.81.187 published on Monday, Apr 28, 2025 by tencentcloudstack

tencentcloud.ClbTargetGroupAttachments

Explore with Pulumi AI

Provides a resource to create a clb target_group_attachments

This resource supports bidirectional binding (target group binding to the load balancer, load balancer binding to the target group). When choosing either the load balancer or the target group as the binding target, up to 20 combinations can be bound at most.

Example Usage

Load balancer binding to the target group

import * as pulumi from "@pulumi/pulumi";
import * as tencentcloud from "@pulumi/tencentcloud";

const targetGroupAttachments = new tencentcloud.ClbTargetGroupAttachments("targetGroupAttachments", {
    associations: [{
        listenerId: "lbl-m2q6sp9m",
        locationId: "loc-jjqr0ric",
        targetGroupId: "lbtg-5xunivs0",
    }],
    loadBalancerId: "lb-phbx2420",
});
Copy
import pulumi
import pulumi_tencentcloud as tencentcloud

target_group_attachments = tencentcloud.ClbTargetGroupAttachments("targetGroupAttachments",
    associations=[{
        "listener_id": "lbl-m2q6sp9m",
        "location_id": "loc-jjqr0ric",
        "target_group_id": "lbtg-5xunivs0",
    }],
    load_balancer_id="lb-phbx2420")
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/tencentcloud/tencentcloud"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := tencentcloud.NewClbTargetGroupAttachments(ctx, "targetGroupAttachments", &tencentcloud.ClbTargetGroupAttachmentsArgs{
			Associations: tencentcloud.ClbTargetGroupAttachmentsAssociationArray{
				&tencentcloud.ClbTargetGroupAttachmentsAssociationArgs{
					ListenerId:    pulumi.String("lbl-m2q6sp9m"),
					LocationId:    pulumi.String("loc-jjqr0ric"),
					TargetGroupId: pulumi.String("lbtg-5xunivs0"),
				},
			},
			LoadBalancerId: pulumi.String("lb-phbx2420"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Tencentcloud = Pulumi.Tencentcloud;

return await Deployment.RunAsync(() => 
{
    var targetGroupAttachments = new Tencentcloud.ClbTargetGroupAttachments("targetGroupAttachments", new()
    {
        Associations = new[]
        {
            new Tencentcloud.Inputs.ClbTargetGroupAttachmentsAssociationArgs
            {
                ListenerId = "lbl-m2q6sp9m",
                LocationId = "loc-jjqr0ric",
                TargetGroupId = "lbtg-5xunivs0",
            },
        },
        LoadBalancerId = "lb-phbx2420",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.tencentcloud.ClbTargetGroupAttachments;
import com.pulumi.tencentcloud.ClbTargetGroupAttachmentsArgs;
import com.pulumi.tencentcloud.inputs.ClbTargetGroupAttachmentsAssociationArgs;
import java.util.List;
import java.util.ArrayList;
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) {
        var targetGroupAttachments = new ClbTargetGroupAttachments("targetGroupAttachments", ClbTargetGroupAttachmentsArgs.builder()
            .associations(ClbTargetGroupAttachmentsAssociationArgs.builder()
                .listenerId("lbl-m2q6sp9m")
                .locationId("loc-jjqr0ric")
                .targetGroupId("lbtg-5xunivs0")
                .build())
            .loadBalancerId("lb-phbx2420")
            .build());

    }
}
Copy
resources:
  targetGroupAttachments:
    type: tencentcloud:ClbTargetGroupAttachments
    properties:
      associations:
        - listenerId: lbl-m2q6sp9m
          locationId: loc-jjqr0ric
          targetGroupId: lbtg-5xunivs0
      loadBalancerId: lb-phbx2420
Copy

Target group binding to the load balancer

import * as pulumi from "@pulumi/pulumi";
import * as tencentcloud from "@pulumi/tencentcloud";

const targetGroupAttachments = new tencentcloud.ClbTargetGroupAttachments("targetGroupAttachments", {
    associations: [{
        listenerId: "lbl-m2q6sp9m",
        loadBalancerId: "lb-phbx2420",
        locationId: "loc-jjqr0ric",
    }],
    targetGroupId: "lbtg-5xunivs0",
});
Copy
import pulumi
import pulumi_tencentcloud as tencentcloud

target_group_attachments = tencentcloud.ClbTargetGroupAttachments("targetGroupAttachments",
    associations=[{
        "listener_id": "lbl-m2q6sp9m",
        "load_balancer_id": "lb-phbx2420",
        "location_id": "loc-jjqr0ric",
    }],
    target_group_id="lbtg-5xunivs0")
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/tencentcloud/tencentcloud"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := tencentcloud.NewClbTargetGroupAttachments(ctx, "targetGroupAttachments", &tencentcloud.ClbTargetGroupAttachmentsArgs{
			Associations: tencentcloud.ClbTargetGroupAttachmentsAssociationArray{
				&tencentcloud.ClbTargetGroupAttachmentsAssociationArgs{
					ListenerId:     pulumi.String("lbl-m2q6sp9m"),
					LoadBalancerId: pulumi.String("lb-phbx2420"),
					LocationId:     pulumi.String("loc-jjqr0ric"),
				},
			},
			TargetGroupId: pulumi.String("lbtg-5xunivs0"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Tencentcloud = Pulumi.Tencentcloud;

return await Deployment.RunAsync(() => 
{
    var targetGroupAttachments = new Tencentcloud.ClbTargetGroupAttachments("targetGroupAttachments", new()
    {
        Associations = new[]
        {
            new Tencentcloud.Inputs.ClbTargetGroupAttachmentsAssociationArgs
            {
                ListenerId = "lbl-m2q6sp9m",
                LoadBalancerId = "lb-phbx2420",
                LocationId = "loc-jjqr0ric",
            },
        },
        TargetGroupId = "lbtg-5xunivs0",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.tencentcloud.ClbTargetGroupAttachments;
import com.pulumi.tencentcloud.ClbTargetGroupAttachmentsArgs;
import com.pulumi.tencentcloud.inputs.ClbTargetGroupAttachmentsAssociationArgs;
import java.util.List;
import java.util.ArrayList;
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) {
        var targetGroupAttachments = new ClbTargetGroupAttachments("targetGroupAttachments", ClbTargetGroupAttachmentsArgs.builder()
            .associations(ClbTargetGroupAttachmentsAssociationArgs.builder()
                .listenerId("lbl-m2q6sp9m")
                .loadBalancerId("lb-phbx2420")
                .locationId("loc-jjqr0ric")
                .build())
            .targetGroupId("lbtg-5xunivs0")
            .build());

    }
}
Copy
resources:
  targetGroupAttachments:
    type: tencentcloud:ClbTargetGroupAttachments
    properties:
      associations:
        - listenerId: lbl-m2q6sp9m
          loadBalancerId: lb-phbx2420
          locationId: loc-jjqr0ric
      targetGroupId: lbtg-5xunivs0
Copy

Create ClbTargetGroupAttachments Resource

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

Constructor syntax

new ClbTargetGroupAttachments(name: string, args: ClbTargetGroupAttachmentsArgs, opts?: CustomResourceOptions);
@overload
def ClbTargetGroupAttachments(resource_name: str,
                              args: ClbTargetGroupAttachmentsArgs,
                              opts: Optional[ResourceOptions] = None)

@overload
def ClbTargetGroupAttachments(resource_name: str,
                              opts: Optional[ResourceOptions] = None,
                              associations: Optional[Sequence[ClbTargetGroupAttachmentsAssociationArgs]] = None,
                              clb_target_group_attachments_id: Optional[str] = None,
                              load_balancer_id: Optional[str] = None,
                              target_group_id: Optional[str] = None)
func NewClbTargetGroupAttachments(ctx *Context, name string, args ClbTargetGroupAttachmentsArgs, opts ...ResourceOption) (*ClbTargetGroupAttachments, error)
public ClbTargetGroupAttachments(string name, ClbTargetGroupAttachmentsArgs args, CustomResourceOptions? opts = null)
public ClbTargetGroupAttachments(String name, ClbTargetGroupAttachmentsArgs args)
public ClbTargetGroupAttachments(String name, ClbTargetGroupAttachmentsArgs args, CustomResourceOptions options)
type: tencentcloud:ClbTargetGroupAttachments
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

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

ClbTargetGroupAttachments 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 ClbTargetGroupAttachments resource accepts the following input properties:

Associations This property is required. List<ClbTargetGroupAttachmentsAssociation>
Association array, the combination cannot exceed 20.
ClbTargetGroupAttachmentsId string
ID of the resource.
LoadBalancerId string
CLB instance ID, (load_balancer_id and target_group_id require at least one).
TargetGroupId string
Target group ID, (load_balancer_id and target_group_id require at least one).
Associations This property is required. []ClbTargetGroupAttachmentsAssociationArgs
Association array, the combination cannot exceed 20.
ClbTargetGroupAttachmentsId string
ID of the resource.
LoadBalancerId string
CLB instance ID, (load_balancer_id and target_group_id require at least one).
TargetGroupId string
Target group ID, (load_balancer_id and target_group_id require at least one).
associations This property is required. List<ClbTargetGroupAttachmentsAssociation>
Association array, the combination cannot exceed 20.
clbTargetGroupAttachmentsId String
ID of the resource.
loadBalancerId String
CLB instance ID, (load_balancer_id and target_group_id require at least one).
targetGroupId String
Target group ID, (load_balancer_id and target_group_id require at least one).
associations This property is required. ClbTargetGroupAttachmentsAssociation[]
Association array, the combination cannot exceed 20.
clbTargetGroupAttachmentsId string
ID of the resource.
loadBalancerId string
CLB instance ID, (load_balancer_id and target_group_id require at least one).
targetGroupId string
Target group ID, (load_balancer_id and target_group_id require at least one).
associations This property is required. Sequence[ClbTargetGroupAttachmentsAssociationArgs]
Association array, the combination cannot exceed 20.
clb_target_group_attachments_id str
ID of the resource.
load_balancer_id str
CLB instance ID, (load_balancer_id and target_group_id require at least one).
target_group_id str
Target group ID, (load_balancer_id and target_group_id require at least one).
associations This property is required. List<Property Map>
Association array, the combination cannot exceed 20.
clbTargetGroupAttachmentsId String
ID of the resource.
loadBalancerId String
CLB instance ID, (load_balancer_id and target_group_id require at least one).
targetGroupId String
Target group ID, (load_balancer_id and target_group_id require at least one).

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing ClbTargetGroupAttachments Resource

Get an existing ClbTargetGroupAttachments 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?: ClbTargetGroupAttachmentsState, opts?: CustomResourceOptions): ClbTargetGroupAttachments
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        associations: Optional[Sequence[ClbTargetGroupAttachmentsAssociationArgs]] = None,
        clb_target_group_attachments_id: Optional[str] = None,
        load_balancer_id: Optional[str] = None,
        target_group_id: Optional[str] = None) -> ClbTargetGroupAttachments
func GetClbTargetGroupAttachments(ctx *Context, name string, id IDInput, state *ClbTargetGroupAttachmentsState, opts ...ResourceOption) (*ClbTargetGroupAttachments, error)
public static ClbTargetGroupAttachments Get(string name, Input<string> id, ClbTargetGroupAttachmentsState? state, CustomResourceOptions? opts = null)
public static ClbTargetGroupAttachments get(String name, Output<String> id, ClbTargetGroupAttachmentsState state, CustomResourceOptions options)
resources:  _:    type: tencentcloud:ClbTargetGroupAttachments    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
Associations List<ClbTargetGroupAttachmentsAssociation>
Association array, the combination cannot exceed 20.
ClbTargetGroupAttachmentsId string
ID of the resource.
LoadBalancerId string
CLB instance ID, (load_balancer_id and target_group_id require at least one).
TargetGroupId string
Target group ID, (load_balancer_id and target_group_id require at least one).
Associations []ClbTargetGroupAttachmentsAssociationArgs
Association array, the combination cannot exceed 20.
ClbTargetGroupAttachmentsId string
ID of the resource.
LoadBalancerId string
CLB instance ID, (load_balancer_id and target_group_id require at least one).
TargetGroupId string
Target group ID, (load_balancer_id and target_group_id require at least one).
associations List<ClbTargetGroupAttachmentsAssociation>
Association array, the combination cannot exceed 20.
clbTargetGroupAttachmentsId String
ID of the resource.
loadBalancerId String
CLB instance ID, (load_balancer_id and target_group_id require at least one).
targetGroupId String
Target group ID, (load_balancer_id and target_group_id require at least one).
associations ClbTargetGroupAttachmentsAssociation[]
Association array, the combination cannot exceed 20.
clbTargetGroupAttachmentsId string
ID of the resource.
loadBalancerId string
CLB instance ID, (load_balancer_id and target_group_id require at least one).
targetGroupId string
Target group ID, (load_balancer_id and target_group_id require at least one).
associations Sequence[ClbTargetGroupAttachmentsAssociationArgs]
Association array, the combination cannot exceed 20.
clb_target_group_attachments_id str
ID of the resource.
load_balancer_id str
CLB instance ID, (load_balancer_id and target_group_id require at least one).
target_group_id str
Target group ID, (load_balancer_id and target_group_id require at least one).
associations List<Property Map>
Association array, the combination cannot exceed 20.
clbTargetGroupAttachmentsId String
ID of the resource.
loadBalancerId String
CLB instance ID, (load_balancer_id and target_group_id require at least one).
targetGroupId String
Target group ID, (load_balancer_id and target_group_id require at least one).

Supporting Types

ClbTargetGroupAttachmentsAssociation
, ClbTargetGroupAttachmentsAssociationArgs

ListenerId string
Listener ID.
LoadBalancerId string
CLB instance ID, when the binding target is target group, load_balancer_id in associations is required.
LocationId string
Forwarding rule ID.
TargetGroupId string
Target group ID, when the binding target is clb, the target_group_id in associations is required.
ListenerId string
Listener ID.
LoadBalancerId string
CLB instance ID, when the binding target is target group, load_balancer_id in associations is required.
LocationId string
Forwarding rule ID.
TargetGroupId string
Target group ID, when the binding target is clb, the target_group_id in associations is required.
listenerId String
Listener ID.
loadBalancerId String
CLB instance ID, when the binding target is target group, load_balancer_id in associations is required.
locationId String
Forwarding rule ID.
targetGroupId String
Target group ID, when the binding target is clb, the target_group_id in associations is required.
listenerId string
Listener ID.
loadBalancerId string
CLB instance ID, when the binding target is target group, load_balancer_id in associations is required.
locationId string
Forwarding rule ID.
targetGroupId string
Target group ID, when the binding target is clb, the target_group_id in associations is required.
listener_id str
Listener ID.
load_balancer_id str
CLB instance ID, when the binding target is target group, load_balancer_id in associations is required.
location_id str
Forwarding rule ID.
target_group_id str
Target group ID, when the binding target is clb, the target_group_id in associations is required.
listenerId String
Listener ID.
loadBalancerId String
CLB instance ID, when the binding target is target group, load_balancer_id in associations is required.
locationId String
Forwarding rule ID.
targetGroupId String
Target group ID, when the binding target is clb, the target_group_id in associations is required.

Package Details

Repository
tencentcloud tencentcloudstack/terraform-provider-tencentcloud
License
Notes
This Pulumi package is based on the tencentcloud Terraform Provider.