tencentcloud.ClbTargetGroupAttachment
Explore with Pulumi AI
Provides a resource to create a CLB target group attachment is bound to the load balancing listener or forwarding rule.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as tencentcloud from "@pulumi/tencentcloud";
const config = new pulumi.Config();
const availabilityZone = config.get("availabilityZone") || "ap-guangzhou-6";
// create vpc
const vpc = new tencentcloud.Vpc("vpc", {cidrBlock: "10.0.0.0/16"});
// create subnet
const subnet = new tencentcloud.Subnet("subnet", {
vpcId: vpc.vpcId,
availabilityZone: availabilityZone,
cidrBlock: "10.0.1.0/24",
isMulticast: false,
});
// create clb instance
const exampleClbInstance = new tencentcloud.ClbInstance("exampleClbInstance", {
clbName: "tf-example",
networkType: "INTERNAL",
vpcId: vpc.vpcId,
subnetId: subnet.subnetId,
});
// create clb listener
const exampleClbListener = new tencentcloud.ClbListener("exampleClbListener", {
clbId: exampleClbInstance.clbInstanceId,
listenerName: "tf-example",
port: 8080,
protocol: "HTTP",
});
// create clb listener rule
const exampleClbListenerRule = new tencentcloud.ClbListenerRule("exampleClbListenerRule", {
clbId: exampleClbInstance.clbInstanceId,
listenerId: exampleClbListener.listenerId,
domain: "example.com",
url: "/",
sessionExpireTime: 60,
scheduler: "WRR",
targetType: "TARGETGROUP",
});
// create clb target group
const exampleClbTargetGroup = new tencentcloud.ClbTargetGroup("exampleClbTargetGroup", {
targetGroupName: "tf-example",
vpcId: vpc.vpcId,
});
// create clb target group attachment
const exampleClbTargetGroupAttachment = new tencentcloud.ClbTargetGroupAttachment("exampleClbTargetGroupAttachment", {
clbId: exampleClbInstance.clbInstanceId,
targetGroupId: exampleClbTargetGroup.clbTargetGroupId,
listenerId: exampleClbListener.listenerId,
ruleId: exampleClbListenerRule.ruleId,
});
import pulumi
import pulumi_tencentcloud as tencentcloud
config = pulumi.Config()
availability_zone = config.get("availabilityZone")
if availability_zone is None:
availability_zone = "ap-guangzhou-6"
# create vpc
vpc = tencentcloud.Vpc("vpc", cidr_block="10.0.0.0/16")
# create subnet
subnet = tencentcloud.Subnet("subnet",
vpc_id=vpc.vpc_id,
availability_zone=availability_zone,
cidr_block="10.0.1.0/24",
is_multicast=False)
# create clb instance
example_clb_instance = tencentcloud.ClbInstance("exampleClbInstance",
clb_name="tf-example",
network_type="INTERNAL",
vpc_id=vpc.vpc_id,
subnet_id=subnet.subnet_id)
# create clb listener
example_clb_listener = tencentcloud.ClbListener("exampleClbListener",
clb_id=example_clb_instance.clb_instance_id,
listener_name="tf-example",
port=8080,
protocol="HTTP")
# create clb listener rule
example_clb_listener_rule = tencentcloud.ClbListenerRule("exampleClbListenerRule",
clb_id=example_clb_instance.clb_instance_id,
listener_id=example_clb_listener.listener_id,
domain="example.com",
url="/",
session_expire_time=60,
scheduler="WRR",
target_type="TARGETGROUP")
# create clb target group
example_clb_target_group = tencentcloud.ClbTargetGroup("exampleClbTargetGroup",
target_group_name="tf-example",
vpc_id=vpc.vpc_id)
# create clb target group attachment
example_clb_target_group_attachment = tencentcloud.ClbTargetGroupAttachment("exampleClbTargetGroupAttachment",
clb_id=example_clb_instance.clb_instance_id,
target_group_id=example_clb_target_group.clb_target_group_id,
listener_id=example_clb_listener.listener_id,
rule_id=example_clb_listener_rule.rule_id)
package main
import (
"github.com/pulumi/pulumi-terraform-provider/sdks/go/tencentcloud/tencentcloud"
"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, "")
availabilityZone := "ap-guangzhou-6"
if param := cfg.Get("availabilityZone"); param != "" {
availabilityZone = param
}
// create vpc
vpc, err := tencentcloud.NewVpc(ctx, "vpc", &tencentcloud.VpcArgs{
CidrBlock: pulumi.String("10.0.0.0/16"),
})
if err != nil {
return err
}
// create subnet
subnet, err := tencentcloud.NewSubnet(ctx, "subnet", &tencentcloud.SubnetArgs{
VpcId: vpc.VpcId,
AvailabilityZone: pulumi.String(availabilityZone),
CidrBlock: pulumi.String("10.0.1.0/24"),
IsMulticast: pulumi.Bool(false),
})
if err != nil {
return err
}
// create clb instance
exampleClbInstance, err := tencentcloud.NewClbInstance(ctx, "exampleClbInstance", &tencentcloud.ClbInstanceArgs{
ClbName: pulumi.String("tf-example"),
NetworkType: pulumi.String("INTERNAL"),
VpcId: vpc.VpcId,
SubnetId: subnet.SubnetId,
})
if err != nil {
return err
}
// create clb listener
exampleClbListener, err := tencentcloud.NewClbListener(ctx, "exampleClbListener", &tencentcloud.ClbListenerArgs{
ClbId: exampleClbInstance.ClbInstanceId,
ListenerName: pulumi.String("tf-example"),
Port: pulumi.Float64(8080),
Protocol: pulumi.String("HTTP"),
})
if err != nil {
return err
}
// create clb listener rule
exampleClbListenerRule, err := tencentcloud.NewClbListenerRule(ctx, "exampleClbListenerRule", &tencentcloud.ClbListenerRuleArgs{
ClbId: exampleClbInstance.ClbInstanceId,
ListenerId: exampleClbListener.ListenerId,
Domain: pulumi.String("example.com"),
Url: pulumi.String("/"),
SessionExpireTime: pulumi.Float64(60),
Scheduler: pulumi.String("WRR"),
TargetType: pulumi.String("TARGETGROUP"),
})
if err != nil {
return err
}
// create clb target group
exampleClbTargetGroup, err := tencentcloud.NewClbTargetGroup(ctx, "exampleClbTargetGroup", &tencentcloud.ClbTargetGroupArgs{
TargetGroupName: pulumi.String("tf-example"),
VpcId: vpc.VpcId,
})
if err != nil {
return err
}
// create clb target group attachment
_, err = tencentcloud.NewClbTargetGroupAttachment(ctx, "exampleClbTargetGroupAttachment", &tencentcloud.ClbTargetGroupAttachmentArgs{
ClbId: exampleClbInstance.ClbInstanceId,
TargetGroupId: exampleClbTargetGroup.ClbTargetGroupId,
ListenerId: exampleClbListener.ListenerId,
RuleId: exampleClbListenerRule.RuleId,
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Tencentcloud = Pulumi.Tencentcloud;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var availabilityZone = config.Get("availabilityZone") ?? "ap-guangzhou-6";
// create vpc
var vpc = new Tencentcloud.Vpc("vpc", new()
{
CidrBlock = "10.0.0.0/16",
});
// create subnet
var subnet = new Tencentcloud.Subnet("subnet", new()
{
VpcId = vpc.VpcId,
AvailabilityZone = availabilityZone,
CidrBlock = "10.0.1.0/24",
IsMulticast = false,
});
// create clb instance
var exampleClbInstance = new Tencentcloud.ClbInstance("exampleClbInstance", new()
{
ClbName = "tf-example",
NetworkType = "INTERNAL",
VpcId = vpc.VpcId,
SubnetId = subnet.SubnetId,
});
// create clb listener
var exampleClbListener = new Tencentcloud.ClbListener("exampleClbListener", new()
{
ClbId = exampleClbInstance.ClbInstanceId,
ListenerName = "tf-example",
Port = 8080,
Protocol = "HTTP",
});
// create clb listener rule
var exampleClbListenerRule = new Tencentcloud.ClbListenerRule("exampleClbListenerRule", new()
{
ClbId = exampleClbInstance.ClbInstanceId,
ListenerId = exampleClbListener.ListenerId,
Domain = "example.com",
Url = "/",
SessionExpireTime = 60,
Scheduler = "WRR",
TargetType = "TARGETGROUP",
});
// create clb target group
var exampleClbTargetGroup = new Tencentcloud.ClbTargetGroup("exampleClbTargetGroup", new()
{
TargetGroupName = "tf-example",
VpcId = vpc.VpcId,
});
// create clb target group attachment
var exampleClbTargetGroupAttachment = new Tencentcloud.ClbTargetGroupAttachment("exampleClbTargetGroupAttachment", new()
{
ClbId = exampleClbInstance.ClbInstanceId,
TargetGroupId = exampleClbTargetGroup.ClbTargetGroupId,
ListenerId = exampleClbListener.ListenerId,
RuleId = exampleClbListenerRule.RuleId,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.tencentcloud.Vpc;
import com.pulumi.tencentcloud.VpcArgs;
import com.pulumi.tencentcloud.Subnet;
import com.pulumi.tencentcloud.SubnetArgs;
import com.pulumi.tencentcloud.ClbInstance;
import com.pulumi.tencentcloud.ClbInstanceArgs;
import com.pulumi.tencentcloud.ClbListener;
import com.pulumi.tencentcloud.ClbListenerArgs;
import com.pulumi.tencentcloud.ClbListenerRule;
import com.pulumi.tencentcloud.ClbListenerRuleArgs;
import com.pulumi.tencentcloud.ClbTargetGroup;
import com.pulumi.tencentcloud.ClbTargetGroupArgs;
import com.pulumi.tencentcloud.ClbTargetGroupAttachment;
import com.pulumi.tencentcloud.ClbTargetGroupAttachmentArgs;
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) {
final var config = ctx.config();
final var availabilityZone = config.get("availabilityZone").orElse("ap-guangzhou-6");
// create vpc
var vpc = new Vpc("vpc", VpcArgs.builder()
.cidrBlock("10.0.0.0/16")
.build());
// create subnet
var subnet = new Subnet("subnet", SubnetArgs.builder()
.vpcId(vpc.vpcId())
.availabilityZone(availabilityZone)
.cidrBlock("10.0.1.0/24")
.isMulticast(false)
.build());
// create clb instance
var exampleClbInstance = new ClbInstance("exampleClbInstance", ClbInstanceArgs.builder()
.clbName("tf-example")
.networkType("INTERNAL")
.vpcId(vpc.vpcId())
.subnetId(subnet.subnetId())
.build());
// create clb listener
var exampleClbListener = new ClbListener("exampleClbListener", ClbListenerArgs.builder()
.clbId(exampleClbInstance.clbInstanceId())
.listenerName("tf-example")
.port(8080)
.protocol("HTTP")
.build());
// create clb listener rule
var exampleClbListenerRule = new ClbListenerRule("exampleClbListenerRule", ClbListenerRuleArgs.builder()
.clbId(exampleClbInstance.clbInstanceId())
.listenerId(exampleClbListener.listenerId())
.domain("example.com")
.url("/")
.sessionExpireTime(60)
.scheduler("WRR")
.targetType("TARGETGROUP")
.build());
// create clb target group
var exampleClbTargetGroup = new ClbTargetGroup("exampleClbTargetGroup", ClbTargetGroupArgs.builder()
.targetGroupName("tf-example")
.vpcId(vpc.vpcId())
.build());
// create clb target group attachment
var exampleClbTargetGroupAttachment = new ClbTargetGroupAttachment("exampleClbTargetGroupAttachment", ClbTargetGroupAttachmentArgs.builder()
.clbId(exampleClbInstance.clbInstanceId())
.targetGroupId(exampleClbTargetGroup.clbTargetGroupId())
.listenerId(exampleClbListener.listenerId())
.ruleId(exampleClbListenerRule.ruleId())
.build());
}
}
configuration:
availabilityZone:
type: string
default: ap-guangzhou-6
resources:
# create vpc
vpc:
type: tencentcloud:Vpc
properties:
cidrBlock: 10.0.0.0/16
# create subnet
subnet:
type: tencentcloud:Subnet
properties:
vpcId: ${vpc.vpcId}
availabilityZone: ${availabilityZone}
cidrBlock: 10.0.1.0/24
isMulticast: false
# create clb instance
exampleClbInstance:
type: tencentcloud:ClbInstance
properties:
clbName: tf-example
networkType: INTERNAL
vpcId: ${vpc.vpcId}
subnetId: ${subnet.subnetId}
# create clb listener
exampleClbListener:
type: tencentcloud:ClbListener
properties:
clbId: ${exampleClbInstance.clbInstanceId}
listenerName: tf-example
port: 8080
protocol: HTTP
# create clb listener rule
exampleClbListenerRule:
type: tencentcloud:ClbListenerRule
properties:
clbId: ${exampleClbInstance.clbInstanceId}
listenerId: ${exampleClbListener.listenerId}
domain: example.com
url: /
sessionExpireTime: 60
scheduler: WRR
targetType: TARGETGROUP
# create clb target group
exampleClbTargetGroup:
type: tencentcloud:ClbTargetGroup
properties:
targetGroupName: tf-example
vpcId: ${vpc.vpcId}
# create clb target group attachment
exampleClbTargetGroupAttachment:
type: tencentcloud:ClbTargetGroupAttachment
properties:
clbId: ${exampleClbInstance.clbInstanceId}
targetGroupId: ${exampleClbTargetGroup.clbTargetGroupId}
listenerId: ${exampleClbListener.listenerId}
ruleId: ${exampleClbListenerRule.ruleId}
Create ClbTargetGroupAttachment Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ClbTargetGroupAttachment(name: string, args: ClbTargetGroupAttachmentArgs, opts?: CustomResourceOptions);
@overload
def ClbTargetGroupAttachment(resource_name: str,
args: ClbTargetGroupAttachmentArgs,
opts: Optional[ResourceOptions] = None)
@overload
def ClbTargetGroupAttachment(resource_name: str,
opts: Optional[ResourceOptions] = None,
clb_id: Optional[str] = None,
target_group_id: Optional[str] = None,
clb_target_group_attachment_id: Optional[str] = None,
listener_id: Optional[str] = None,
rule_id: Optional[str] = None)
func NewClbTargetGroupAttachment(ctx *Context, name string, args ClbTargetGroupAttachmentArgs, opts ...ResourceOption) (*ClbTargetGroupAttachment, error)
public ClbTargetGroupAttachment(string name, ClbTargetGroupAttachmentArgs args, CustomResourceOptions? opts = null)
public ClbTargetGroupAttachment(String name, ClbTargetGroupAttachmentArgs args)
public ClbTargetGroupAttachment(String name, ClbTargetGroupAttachmentArgs args, CustomResourceOptions options)
type: tencentcloud:ClbTargetGroupAttachment
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args ClbTargetGroupAttachmentArgs
- 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 ClbTargetGroupAttachmentArgs
- 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 ClbTargetGroupAttachmentArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ClbTargetGroupAttachmentArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ClbTargetGroupAttachmentArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
ClbTargetGroupAttachment 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 ClbTargetGroupAttachment resource accepts the following input properties:
- Clb
Id string - ID of the CLB.
- Target
Group stringId - ID of the CLB target group.
- Clb
Target stringGroup Attachment Id - ID of the resource.
- Listener
Id string - ID of the CLB listener.
- Rule
Id string - ID of the CLB listener rule.
- Clb
Id string - ID of the CLB.
- Target
Group stringId - ID of the CLB target group.
- Clb
Target stringGroup Attachment Id - ID of the resource.
- Listener
Id string - ID of the CLB listener.
- Rule
Id string - ID of the CLB listener rule.
- clb
Id String - ID of the CLB.
- target
Group StringId - ID of the CLB target group.
- clb
Target StringGroup Attachment Id - ID of the resource.
- listener
Id String - ID of the CLB listener.
- rule
Id String - ID of the CLB listener rule.
- clb
Id string - ID of the CLB.
- target
Group stringId - ID of the CLB target group.
- clb
Target stringGroup Attachment Id - ID of the resource.
- listener
Id string - ID of the CLB listener.
- rule
Id string - ID of the CLB listener rule.
- clb_
id str - ID of the CLB.
- target_
group_ strid - ID of the CLB target group.
- clb_
target_ strgroup_ attachment_ id - ID of the resource.
- listener_
id str - ID of the CLB listener.
- rule_
id str - ID of the CLB listener rule.
- clb
Id String - ID of the CLB.
- target
Group StringId - ID of the CLB target group.
- clb
Target StringGroup Attachment Id - ID of the resource.
- listener
Id String - ID of the CLB listener.
- rule
Id String - ID of the CLB listener rule.
Outputs
All input properties are implicitly available as output properties. Additionally, the ClbTargetGroupAttachment 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 ClbTargetGroupAttachment Resource
Get an existing ClbTargetGroupAttachment 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?: ClbTargetGroupAttachmentState, opts?: CustomResourceOptions): ClbTargetGroupAttachment
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
clb_id: Optional[str] = None,
clb_target_group_attachment_id: Optional[str] = None,
listener_id: Optional[str] = None,
rule_id: Optional[str] = None,
target_group_id: Optional[str] = None) -> ClbTargetGroupAttachment
func GetClbTargetGroupAttachment(ctx *Context, name string, id IDInput, state *ClbTargetGroupAttachmentState, opts ...ResourceOption) (*ClbTargetGroupAttachment, error)
public static ClbTargetGroupAttachment Get(string name, Input<string> id, ClbTargetGroupAttachmentState? state, CustomResourceOptions? opts = null)
public static ClbTargetGroupAttachment get(String name, Output<String> id, ClbTargetGroupAttachmentState state, CustomResourceOptions options)
resources: _: type: tencentcloud:ClbTargetGroupAttachment get: 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.
- Clb
Id string - ID of the CLB.
- Clb
Target stringGroup Attachment Id - ID of the resource.
- Listener
Id string - ID of the CLB listener.
- Rule
Id string - ID of the CLB listener rule.
- Target
Group stringId - ID of the CLB target group.
- Clb
Id string - ID of the CLB.
- Clb
Target stringGroup Attachment Id - ID of the resource.
- Listener
Id string - ID of the CLB listener.
- Rule
Id string - ID of the CLB listener rule.
- Target
Group stringId - ID of the CLB target group.
- clb
Id String - ID of the CLB.
- clb
Target StringGroup Attachment Id - ID of the resource.
- listener
Id String - ID of the CLB listener.
- rule
Id String - ID of the CLB listener rule.
- target
Group StringId - ID of the CLB target group.
- clb
Id string - ID of the CLB.
- clb
Target stringGroup Attachment Id - ID of the resource.
- listener
Id string - ID of the CLB listener.
- rule
Id string - ID of the CLB listener rule.
- target
Group stringId - ID of the CLB target group.
- clb_
id str - ID of the CLB.
- clb_
target_ strgroup_ attachment_ id - ID of the resource.
- listener_
id str - ID of the CLB listener.
- rule_
id str - ID of the CLB listener rule.
- target_
group_ strid - ID of the CLB target group.
- clb
Id String - ID of the CLB.
- clb
Target StringGroup Attachment Id - ID of the resource.
- listener
Id String - ID of the CLB listener.
- rule
Id String - ID of the CLB listener rule.
- target
Group StringId - ID of the CLB target group.
Import
CLB target group attachment can be imported using the id, e.g.
$ pulumi import tencentcloud:index/clbTargetGroupAttachment:ClbTargetGroupAttachment example lbtg-odareyb2#lbl-bicjmx3i#lb-cv0iz74c#loc-ac6uk7b6
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- tencentcloud tencentcloudstack/terraform-provider-tencentcloud
- License
- Notes
- This Pulumi package is based on the
tencentcloud
Terraform Provider.