@@ -14,48 +14,46 @@ Provides a resource to create a CLB target group instance attachment.
1414## Example Usage
1515
1616``` hcl
17- data "tencentcloud_images" "my_favorite_image" {
17+ data "tencentcloud_availability_zones" "default" {}
18+
19+ data "tencentcloud_images" "images" {
1820 image_type = ["PUBLIC_IMAGE"]
1921 os_name = "centos"
2022}
2123
22- data "tencentcloud_instance_types" "my_favorite_instance_types" {
24+ data "tencentcloud_instance_types" "instance_types" {
25+ cpu_core_count = 2
26+ memory_size = 4
2327 filter {
2428 name = "instance-family"
25- values = ["S3 "]
29+ values = ["S5 "]
2630 }
27-
28- cpu_core_count = 1
29- memory_size = 1
30- }
31-
32- data "tencentcloud_availability_zones" "default" {
3331}
3432
35- resource "tencentcloud_vpc" "app " {
33+ resource "tencentcloud_vpc" "vpc " {
3634 cidr_block = "10.0.0.0/16"
37- name = "awesome_app_vpc "
35+ name = "vpc "
3836}
3937
40- resource "tencentcloud_subnet" "app " {
41- vpc_id = tencentcloud_vpc.app .id
38+ resource "tencentcloud_subnet" "subnet " {
39+ vpc_id = tencentcloud_vpc.vpc .id
4240 availability_zone = data.tencentcloud_availability_zones.default.zones.0.name
43- name = "awesome_app_subnet "
41+ name = "subnet "
4442 cidr_block = "10.0.1.0/24"
4543}
4644
47- resource "tencentcloud_instance" "my_awesome_app " {
48- instance_name = "awesome_app "
45+ resource "tencentcloud_instance" "example " {
46+ instance_name = "tf-example "
4947 availability_zone = data.tencentcloud_availability_zones.default.zones.0.name
50- image_id = data.tencentcloud_images.my_favorite_image .images.0.image_id
51- instance_type = data.tencentcloud_instance_types.my_favorite_instance_types .instance_types.0.instance_type
48+ image_id = data.tencentcloud_images.images .images.0.image_id
49+ instance_type = data.tencentcloud_instance_types.instance_types .instance_types.0.instance_type
5250 system_disk_type = "CLOUD_PREMIUM"
5351 system_disk_size = 50
5452 hostname = "user"
5553 project_id = 0
56- vpc_id = tencentcloud_vpc.app .id
57- subnet_id = tencentcloud_subnet.app .id
58- internet_max_bandwidth_out = 20
54+ vpc_id = tencentcloud_vpc.vpc .id
55+ subnet_id = tencentcloud_subnet.subnet .id
56+ internet_max_bandwidth_out = 100
5957
6058 data_disks {
6159 data_disk_type = "CLOUD_PREMIUM"
@@ -68,20 +66,20 @@ resource "tencentcloud_instance" "my_awesome_app" {
6866 }
6967}
7068
71- data "tencentcloud_instances" "foo " {
72- instance_id = tencentcloud_instance.my_awesome_app .id
69+ data "tencentcloud_instances" "instances " {
70+ instance_id = tencentcloud_instance.example .id
7371}
7472
75- resource "tencentcloud_clb_target_group" "test " {
76- target_group_name = "test "
77- vpc_id = tencentcloud_vpc.app .id
73+ resource "tencentcloud_clb_target_group" "example " {
74+ target_group_name = "tf-example "
75+ vpc_id = tencentcloud_vpc.vpc .id
7876}
7977
80- resource "tencentcloud_clb_target_group_instance_attachment" "test " {
81- target_group_id = tencentcloud_clb_target_group.test .id
82- bind_ip = data.tencentcloud_instances.foo .instance_list[0].private_ip
83- port = 222
84- weight = 3
78+ resource "tencentcloud_clb_target_group_instance_attachment" "example " {
79+ target_group_id = tencentcloud_clb_target_group.example .id
80+ bind_ip = data.tencentcloud_instances.instances .instance_list[0].private_ip
81+ port = 8080
82+ weight = 10
8583}
8684```
8785
@@ -107,6 +105,6 @@ In addition to all arguments above, the following attributes are exported:
107105CLB target group instance attachment can be imported using the id, e.g.
108106
109107```
110- $ terraform import tencentcloud_clb_target_group_instance_attachment.test lbtg-3k3io0i0#172.16.48.18#222
108+ $ terraform import tencentcloud_clb_target_group_instance_attachment.example lbtg-3k3io0i0#172.16.48.18#8080
111109```
112110
0 commit comments