1. Packages
  2. Tencentcloud Provider
  3. API Docs
  4. AlbServerAttachment
tencentcloud 1.81.183 published on Wednesday, Apr 16, 2025 by tencentcloudstack

tencentcloud.AlbServerAttachment

Explore with Pulumi AI

Provides an tencentcloud application load balancer servers attachment as a resource, to attach and detach instances from load balancer.

NOTE: It has been deprecated and replaced by tencentcloud.ClbAttachment.

NOTE: Currently only support existing loadbalancer_id listener_id location_id and Application layer 7 load balancer

Example Usage

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

const service1 = new tencentcloud.AlbServerAttachment("service1", {
    backends: [
        {
            instanceId: "ins-4j30i5pe",
            port: 80,
            weight: 50,
        },
        {
            instanceId: "ins-4j30i5pe",
            port: 8080,
            weight: 50,
        },
    ],
    listenerId: "lbl-ghoke4tl",
    loadbalancerId: "lb-qk1dqox5",
    locationId: "loc-i858qv1l",
});
Copy
import pulumi
import pulumi_tencentcloud as tencentcloud

service1 = tencentcloud.AlbServerAttachment("service1",
    backends=[
        {
            "instance_id": "ins-4j30i5pe",
            "port": 80,
            "weight": 50,
        },
        {
            "instance_id": "ins-4j30i5pe",
            "port": 8080,
            "weight": 50,
        },
    ],
    listener_id="lbl-ghoke4tl",
    loadbalancer_id="lb-qk1dqox5",
    location_id="loc-i858qv1l")
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.NewAlbServerAttachment(ctx, "service1", &tencentcloud.AlbServerAttachmentArgs{
			Backends: tencentcloud.AlbServerAttachmentBackendArray{
				&tencentcloud.AlbServerAttachmentBackendArgs{
					InstanceId: pulumi.String("ins-4j30i5pe"),
					Port:       pulumi.Float64(80),
					Weight:     pulumi.Float64(50),
				},
				&tencentcloud.AlbServerAttachmentBackendArgs{
					InstanceId: pulumi.String("ins-4j30i5pe"),
					Port:       pulumi.Float64(8080),
					Weight:     pulumi.Float64(50),
				},
			},
			ListenerId:     pulumi.String("lbl-ghoke4tl"),
			LoadbalancerId: pulumi.String("lb-qk1dqox5"),
			LocationId:     pulumi.String("loc-i858qv1l"),
		})
		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 service1 = new Tencentcloud.AlbServerAttachment("service1", new()
    {
        Backends = new[]
        {
            new Tencentcloud.Inputs.AlbServerAttachmentBackendArgs
            {
                InstanceId = "ins-4j30i5pe",
                Port = 80,
                Weight = 50,
            },
            new Tencentcloud.Inputs.AlbServerAttachmentBackendArgs
            {
                InstanceId = "ins-4j30i5pe",
                Port = 8080,
                Weight = 50,
            },
        },
        ListenerId = "lbl-ghoke4tl",
        LoadbalancerId = "lb-qk1dqox5",
        LocationId = "loc-i858qv1l",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.tencentcloud.AlbServerAttachment;
import com.pulumi.tencentcloud.AlbServerAttachmentArgs;
import com.pulumi.tencentcloud.inputs.AlbServerAttachmentBackendArgs;
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 service1 = new AlbServerAttachment("service1", AlbServerAttachmentArgs.builder()
            .backends(            
                AlbServerAttachmentBackendArgs.builder()
                    .instanceId("ins-4j30i5pe")
                    .port(80)
                    .weight(50)
                    .build(),
                AlbServerAttachmentBackendArgs.builder()
                    .instanceId("ins-4j30i5pe")
                    .port(8080)
                    .weight(50)
                    .build())
            .listenerId("lbl-ghoke4tl")
            .loadbalancerId("lb-qk1dqox5")
            .locationId("loc-i858qv1l")
            .build());

    }
}
Copy
resources:
  service1:
    type: tencentcloud:AlbServerAttachment
    properties:
      backends:
        - instanceId: ins-4j30i5pe
          port: 80
          weight: 50
        - instanceId: ins-4j30i5pe
          port: 8080
          weight: 50
      listenerId: lbl-ghoke4tl
      loadbalancerId: lb-qk1dqox5
      locationId: loc-i858qv1l
Copy

Create AlbServerAttachment Resource

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

Constructor syntax

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

@overload
def AlbServerAttachment(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        backends: Optional[Sequence[AlbServerAttachmentBackendArgs]] = None,
                        listener_id: Optional[str] = None,
                        loadbalancer_id: Optional[str] = None,
                        alb_server_attachment_id: Optional[str] = None,
                        location_id: Optional[str] = None)
func NewAlbServerAttachment(ctx *Context, name string, args AlbServerAttachmentArgs, opts ...ResourceOption) (*AlbServerAttachment, error)
public AlbServerAttachment(string name, AlbServerAttachmentArgs args, CustomResourceOptions? opts = null)
public AlbServerAttachment(String name, AlbServerAttachmentArgs args)
public AlbServerAttachment(String name, AlbServerAttachmentArgs args, CustomResourceOptions options)
type: tencentcloud:AlbServerAttachment
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. AlbServerAttachmentArgs
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. AlbServerAttachmentArgs
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. AlbServerAttachmentArgs
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. AlbServerAttachmentArgs
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. AlbServerAttachmentArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

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

Backends This property is required. List<AlbServerAttachmentBackend>
list of backend server.
ListenerId This property is required. string
listener ID.
LoadbalancerId This property is required. string
loadbalancer ID.
AlbServerAttachmentId string
ID of the resource.
LocationId string
location ID, only support for layer 7 loadbalancer.
Backends This property is required. []AlbServerAttachmentBackendArgs
list of backend server.
ListenerId This property is required. string
listener ID.
LoadbalancerId This property is required. string
loadbalancer ID.
AlbServerAttachmentId string
ID of the resource.
LocationId string
location ID, only support for layer 7 loadbalancer.
backends This property is required. List<AlbServerAttachmentBackend>
list of backend server.
listenerId This property is required. String
listener ID.
loadbalancerId This property is required. String
loadbalancer ID.
albServerAttachmentId String
ID of the resource.
locationId String
location ID, only support for layer 7 loadbalancer.
backends This property is required. AlbServerAttachmentBackend[]
list of backend server.
listenerId This property is required. string
listener ID.
loadbalancerId This property is required. string
loadbalancer ID.
albServerAttachmentId string
ID of the resource.
locationId string
location ID, only support for layer 7 loadbalancer.
backends This property is required. Sequence[AlbServerAttachmentBackendArgs]
list of backend server.
listener_id This property is required. str
listener ID.
loadbalancer_id This property is required. str
loadbalancer ID.
alb_server_attachment_id str
ID of the resource.
location_id str
location ID, only support for layer 7 loadbalancer.
backends This property is required. List<Property Map>
list of backend server.
listenerId This property is required. String
listener ID.
loadbalancerId This property is required. String
loadbalancer ID.
albServerAttachmentId String
ID of the resource.
locationId String
location ID, only support for layer 7 loadbalancer.

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
ProtocolType string
The protocol type, http or tcp.
Id string
The provider-assigned unique ID for this managed resource.
ProtocolType string
The protocol type, http or tcp.
id String
The provider-assigned unique ID for this managed resource.
protocolType String
The protocol type, http or tcp.
id string
The provider-assigned unique ID for this managed resource.
protocolType string
The protocol type, http or tcp.
id str
The provider-assigned unique ID for this managed resource.
protocol_type str
The protocol type, http or tcp.
id String
The provider-assigned unique ID for this managed resource.
protocolType String
The protocol type, http or tcp.

Look up Existing AlbServerAttachment Resource

Get an existing AlbServerAttachment 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?: AlbServerAttachmentState, opts?: CustomResourceOptions): AlbServerAttachment
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        alb_server_attachment_id: Optional[str] = None,
        backends: Optional[Sequence[AlbServerAttachmentBackendArgs]] = None,
        listener_id: Optional[str] = None,
        loadbalancer_id: Optional[str] = None,
        location_id: Optional[str] = None,
        protocol_type: Optional[str] = None) -> AlbServerAttachment
func GetAlbServerAttachment(ctx *Context, name string, id IDInput, state *AlbServerAttachmentState, opts ...ResourceOption) (*AlbServerAttachment, error)
public static AlbServerAttachment Get(string name, Input<string> id, AlbServerAttachmentState? state, CustomResourceOptions? opts = null)
public static AlbServerAttachment get(String name, Output<String> id, AlbServerAttachmentState state, CustomResourceOptions options)
resources:  _:    type: tencentcloud:AlbServerAttachment    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:
AlbServerAttachmentId string
ID of the resource.
Backends List<AlbServerAttachmentBackend>
list of backend server.
ListenerId string
listener ID.
LoadbalancerId string
loadbalancer ID.
LocationId string
location ID, only support for layer 7 loadbalancer.
ProtocolType string
The protocol type, http or tcp.
AlbServerAttachmentId string
ID of the resource.
Backends []AlbServerAttachmentBackendArgs
list of backend server.
ListenerId string
listener ID.
LoadbalancerId string
loadbalancer ID.
LocationId string
location ID, only support for layer 7 loadbalancer.
ProtocolType string
The protocol type, http or tcp.
albServerAttachmentId String
ID of the resource.
backends List<AlbServerAttachmentBackend>
list of backend server.
listenerId String
listener ID.
loadbalancerId String
loadbalancer ID.
locationId String
location ID, only support for layer 7 loadbalancer.
protocolType String
The protocol type, http or tcp.
albServerAttachmentId string
ID of the resource.
backends AlbServerAttachmentBackend[]
list of backend server.
listenerId string
listener ID.
loadbalancerId string
loadbalancer ID.
locationId string
location ID, only support for layer 7 loadbalancer.
protocolType string
The protocol type, http or tcp.
alb_server_attachment_id str
ID of the resource.
backends Sequence[AlbServerAttachmentBackendArgs]
list of backend server.
listener_id str
listener ID.
loadbalancer_id str
loadbalancer ID.
location_id str
location ID, only support for layer 7 loadbalancer.
protocol_type str
The protocol type, http or tcp.
albServerAttachmentId String
ID of the resource.
backends List<Property Map>
list of backend server.
listenerId String
listener ID.
loadbalancerId String
loadbalancer ID.
locationId String
location ID, only support for layer 7 loadbalancer.
protocolType String
The protocol type, http or tcp.

Supporting Types

AlbServerAttachmentBackend
, AlbServerAttachmentBackendArgs

InstanceId This property is required. string
A list backend instance ID (CVM instance ID).
Port This property is required. double
The port used by the backend server. Valid value range: [1-65535].
Weight double
Weight of the backend server. Valid value range: [0-100]. Default to 10.
InstanceId This property is required. string
A list backend instance ID (CVM instance ID).
Port This property is required. float64
The port used by the backend server. Valid value range: [1-65535].
Weight float64
Weight of the backend server. Valid value range: [0-100]. Default to 10.
instanceId This property is required. String
A list backend instance ID (CVM instance ID).
port This property is required. Double
The port used by the backend server. Valid value range: [1-65535].
weight Double
Weight of the backend server. Valid value range: [0-100]. Default to 10.
instanceId This property is required. string
A list backend instance ID (CVM instance ID).
port This property is required. number
The port used by the backend server. Valid value range: [1-65535].
weight number
Weight of the backend server. Valid value range: [0-100]. Default to 10.
instance_id This property is required. str
A list backend instance ID (CVM instance ID).
port This property is required. float
The port used by the backend server. Valid value range: [1-65535].
weight float
Weight of the backend server. Valid value range: [0-100]. Default to 10.
instanceId This property is required. String
A list backend instance ID (CVM instance ID).
port This property is required. Number
The port used by the backend server. Valid value range: [1-65535].
weight Number
Weight of the backend server. Valid value range: [0-100]. Default to 10.

Package Details

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