Skip to content

Commit cd6c47c

Browse files
authored
fix(clb): [137495591] tencentcloud_clb_security_group_attachment update doc (#3119)
* add * add
1 parent 1b75a2e commit cd6c47c

File tree

4 files changed

+107
-13
lines changed

4 files changed

+107
-13
lines changed

.changelog/3119.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
resource/tencentcloud_clb_security_group_attachment: update doc
3+
```

tencentcloud/services/clb/resource_tc_clb_instance.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ func ResourceTencentCloudClbInstance() *schema.Resource {
107107
"security_groups": {
108108
Type: schema.TypeList,
109109
Optional: true,
110+
Computed: true,
110111
Elem: &schema.Schema{Type: schema.TypeString},
111112
Description: "Security groups of the CLB instance. Supports both `OPEN` and `INTERNAL` CLBs.",
112113
},
Lines changed: 51 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,63 @@
1-
Provides a resource to create a clb security_group_attachment
1+
Provides a resource to create a clb security group attachment
2+
3+
~> **NOTE:** If resource `tencentcloud_clb_security_group_attachment` is used to manage the security group of clb instance, the `security_groups` field cannot be explicitly used in resource `tencentcloud_clb_instance`
24

35
Example Usage
46

57
```hcl
6-
resource "tencentcloud_clb_security_group_attachment" "security_group_attachment" {
7-
security_group = "sg-ijato2x1"
8-
load_balancer_ids = ["lb-5dnrkgry"]
8+
variable "availability_zone" {
9+
default = "ap-guangzhou-6"
10+
}
11+
12+
// create vpc
13+
resource "tencentcloud_vpc" "vpc" {
14+
cidr_block = "10.0.0.0/16"
15+
name = "vpc"
16+
}
17+
18+
// create subnet
19+
resource "tencentcloud_subnet" "subnet" {
20+
vpc_id = tencentcloud_vpc.vpc.id
21+
availability_zone = var.availability_zone
22+
name = "subnet"
23+
cidr_block = "10.0.1.0/24"
24+
is_multicast = false
25+
}
26+
27+
// create security group
28+
resource "tencentcloud_security_group" "example" {
29+
name = "tf-example"
30+
description = "sg desc."
31+
project_id = 0
32+
33+
tags = {
34+
createBy = "Terraform"
35+
}
36+
}
37+
38+
// create clb instance
39+
resource "tencentcloud_clb_instance" "example" {
40+
network_type = "INTERNAL"
41+
clb_name = "clb-example"
42+
project_id = 0
43+
vpc_id = tencentcloud_vpc.vpc.id
44+
subnet_id = tencentcloud_subnet.subnet.id
45+
tags = {
46+
createBy = "Terraform"
47+
}
48+
}
49+
50+
// attachment
51+
resource "tencentcloud_clb_security_group_attachment" "example" {
52+
security_group = tencentcloud_security_group.example.id
53+
load_balancer_ids = [tencentcloud_clb_instance.example.id]
954
}
1055
```
1156

1257
Import
1358

14-
clb security_group_attachment can be imported using the id, e.g.
59+
clb security group attachment can be imported using the id, e.g.
1560

1661
```
17-
terraform import tencentcloud_clb_security_group_attachment.security_group_attachment security_group_id#clb_id
62+
terraform import tencentcloud_clb_security_group_attachment.example sg-13mgpbm3#lb-gjz8ntf2
1863
```

website/docs/r/clb_security_group_attachment.html.markdown

Lines changed: 52 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,64 @@ layout: "tencentcloud"
44
page_title: "TencentCloud: tencentcloud_clb_security_group_attachment"
55
sidebar_current: "docs-tencentcloud-resource-clb_security_group_attachment"
66
description: |-
7-
Provides a resource to create a clb security_group_attachment
7+
Provides a resource to create a clb security group attachment
88
---
99

1010
# tencentcloud_clb_security_group_attachment
1111

12-
Provides a resource to create a clb security_group_attachment
12+
Provides a resource to create a clb security group attachment
13+
14+
~> **NOTE:** If resource `tencentcloud_clb_security_group_attachment` is used to manage the security group of clb instance, the `security_groups` field cannot be explicitly used in resource `tencentcloud_clb_instance`
1315

1416
## Example Usage
1517

1618
```hcl
17-
resource "tencentcloud_clb_security_group_attachment" "security_group_attachment" {
18-
security_group = "sg-ijato2x1"
19-
load_balancer_ids = ["lb-5dnrkgry"]
19+
variable "availability_zone" {
20+
default = "ap-guangzhou-6"
21+
}
22+
23+
// create vpc
24+
resource "tencentcloud_vpc" "vpc" {
25+
cidr_block = "10.0.0.0/16"
26+
name = "vpc"
27+
}
28+
29+
// create subnet
30+
resource "tencentcloud_subnet" "subnet" {
31+
vpc_id = tencentcloud_vpc.vpc.id
32+
availability_zone = var.availability_zone
33+
name = "subnet"
34+
cidr_block = "10.0.1.0/24"
35+
is_multicast = false
36+
}
37+
38+
// create security group
39+
resource "tencentcloud_security_group" "example" {
40+
name = "tf-example"
41+
description = "sg desc."
42+
project_id = 0
43+
44+
tags = {
45+
createBy = "Terraform"
46+
}
47+
}
48+
49+
// create clb instance
50+
resource "tencentcloud_clb_instance" "example" {
51+
network_type = "INTERNAL"
52+
clb_name = "clb-example"
53+
project_id = 0
54+
vpc_id = tencentcloud_vpc.vpc.id
55+
subnet_id = tencentcloud_subnet.subnet.id
56+
tags = {
57+
createBy = "Terraform"
58+
}
59+
}
60+
61+
// attachment
62+
resource "tencentcloud_clb_security_group_attachment" "example" {
63+
security_group = tencentcloud_security_group.example.id
64+
load_balancer_ids = [tencentcloud_clb_instance.example.id]
2065
}
2166
```
2267

@@ -37,9 +82,9 @@ In addition to all arguments above, the following attributes are exported:
3782

3883
## Import
3984

40-
clb security_group_attachment can be imported using the id, e.g.
85+
clb security group attachment can be imported using the id, e.g.
4186

4287
```
43-
terraform import tencentcloud_clb_security_group_attachment.security_group_attachment security_group_id#clb_id
88+
terraform import tencentcloud_clb_security_group_attachment.example sg-13mgpbm3#lb-gjz8ntf2
4489
```
4590

0 commit comments

Comments
 (0)