Skip to content

Commit 6e8bcce

Browse files
authored
fix(tke): [124743081] Deprecated resourace tencentcloud_kubernetes_addon_attachment (#3412)
* add * add
1 parent 29af5ba commit 6e8bcce

File tree

4 files changed

+63
-52
lines changed

4 files changed

+63
-52
lines changed

.changelog/3412.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_kubernetes_addon_attachment: has been deprecated
3+
```

tencentcloud/services/tke/resource_tc_kubernetes_addon_attachment.go

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tencentcloud/services/tke/resource_tc_kubernetes_addon_attachment.md

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
Provide a resource to configure kubernetes cluster app addons.
22

3+
~> **NOTE**: This resource has been deprecated in Terraform TencentCloud provider version 1.81.200. Please use `tencentcloud_kubernetes_addon` instead.
4+
35
~> **NOTE**: Avoid to using legacy "1.0.0" version, leave the versions empty so we can fetch the latest while creating.
46

57
Example Usage
68

79
Install cbs addon by passing values
810

911
```hcl
10-
11-
resource "tencentcloud_kubernetes_addon_attachment" "addon_cbs" {
12-
cluster_id = "cls-xxxxxxxx"
13-
name = "cbs"
14-
# version = "1.0.5"
12+
resource "tencentcloud_kubernetes_addon_attachment" "example" {
13+
cluster_id = "cls-fdy7hm1q"
14+
name = "cbs"
15+
version = "1.1.7"
1516
values = [
1617
"rootdir=/var/lib/kubelet"
1718
]
@@ -21,8 +22,8 @@ resource "tencentcloud_kubernetes_addon_attachment" "addon_cbs" {
2122
Install tcr addon by passing values
2223

2324
```hcl
24-
resource "tencentcloud_kubernetes_addon_attachment" "addon_tcr" {
25-
cluster_id = "cls-xxxxxxxx" #specify your tke cluster id
25+
resource "tencentcloud_kubernetes_addon_attachment" "example" {
26+
cluster_id = "cls-fdy7hm1q"
2627
name = "tcr"
2728
version = "1.0.0"
2829
values = [
@@ -43,47 +44,48 @@ resource "tencentcloud_kubernetes_addon_attachment" "addon_tcr" {
4344
"global.imagePullSecretsCrs[1].dockerServer=${local.tcr_name}.tencentcloudcr.com", #invalid format as: `${tcr_name}.tencentcloudcr.com`
4445
"global.cluster.region=gz",
4546
"global.cluster.longregion=ap-guangzhou",
47+
4648
# Specify global hosts(optional), the numbers of hosts must be matched with the numbers of imagePullSecretsCrs
47-
"global.hosts[0].domain=${local.tcr_name}-vpc.tencentcloudcr.com", #Corresponds to the dockerServer in the imagePullSecretsCrs above
48-
"global.hosts[0].ip=${local.end_point}", #input InternalEndpoint of tcr instance, you can get it from data source `tencentcloud_tcr_instances`
49-
"global.hosts[0].disabled=false", #disabled this host config or not
49+
"global.hosts[0].domain=${local.tcr_name}-vpc.tencentcloudcr.com", #Corresponds to the dockerServer in the imagePullSecretsCrs above
50+
"global.hosts[0].ip=${local.end_point}", #input InternalEndpoint of tcr instance, you can get it from data source `tencentcloud_tcr_instances`
51+
"global.hosts[0].disabled=false", #disabled this host config or not
5052
"global.hosts[1].domain=${local.tcr_name}.tencentcloudcr.com",
5153
"global.hosts[1].ip=${local.end_point}",
5254
"global.hosts[1].disabled=false",
5355
]
5456
}
5557
5658
locals {
57-
tcr_id = tencentcloud_tcr_instance.mytcr.id
58-
tcr_name = tencentcloud_tcr_instance.mytcr.name
59-
ns_name = tencentcloud_tcr_namespace.my_ns.name
60-
user_name = tencentcloud_tcr_token.my_token.user_name
61-
token = tencentcloud_tcr_token.my_token.token
62-
end_point = data.tencentcloud_tcr_instances.my_ins.instance_list.0.internal_end_point
59+
tcr_id = tencentcloud_tcr_instance.example.id
60+
tcr_name = tencentcloud_tcr_instance.example.name
61+
ns_name = tencentcloud_tcr_namespace.example.name
62+
user_name = tencentcloud_tcr_token.example.user_name
63+
token = tencentcloud_tcr_token.example.token
64+
end_point = data.tencentcloud_tcr_instances.example.instance_list.0.internal_end_point
6365
}
6466
65-
resource "tencentcloud_tcr_token" "my_token" {
67+
resource "tencentcloud_tcr_token" "example" {
6668
instance_id = local.tcr_id
6769
description = "tcr token"
6870
}
6971
70-
data "tencentcloud_tcr_instances" "my_ins" {
72+
data "tencentcloud_tcr_instances" "example" {
7173
instance_id = local.tcr_id
7274
}
7375
74-
resource "tencentcloud_tcr_instance" "mytcr" {
75-
name = "tf-test-tcr-addon"
76+
resource "tencentcloud_tcr_instance" "example" {
77+
name = "tf-example"
7678
instance_type = "basic"
7779
delete_bucket = true
7880
7981
tags = {
80-
test = "test"
82+
createBy = "Terraform"
8183
}
8284
}
8385
84-
resource "tencentcloud_tcr_namespace" "my_ns" {
86+
resource "tencentcloud_tcr_namespace" "example" {
8587
instance_id = local.tcr_id
86-
name = "tf_test_tcr_ns_addon"
88+
name = "tf-example"
8789
is_public = true
8890
is_auto_scan = true
8991
is_prevent_vul = true
@@ -97,8 +99,9 @@ resource "tencentcloud_tcr_namespace" "my_ns" {
9799
Install new addon by passing spec json to req_body directly
98100

99101
```hcl
100-
resource "tencentcloud_kubernetes_addon_attachment" "addon_cbs" {
101-
cluster_id = "cls-xxxxxxxx"
102+
resource "tencentcloud_kubernetes_addon_attachment" "example" {
103+
cluster_id = "cls-fdy7hm1q"
104+
name = "cbs"
102105
request_body = <<EOF
103106
{
104107
"spec":{
@@ -122,5 +125,5 @@ Import
122125

123126
Addon can be imported by using cluster_id#addon_name
124127
```
125-
$ terraform import tencentcloud_kubernetes_addon_attachment.addon_cos cls-xxxxxxxx#cos
126-
```
128+
$ terraform import tencentcloud_kubernetes_addon_attachment.example cls-fdy7hm1q#cbs
129+
```

website/docs/r/kubernetes_addon_attachment.html.markdown

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,19 @@ description: |-
1111

1212
Provide a resource to configure kubernetes cluster app addons.
1313

14+
~> **NOTE**: This resource has been deprecated in Terraform TencentCloud provider version 1.81.200. Please use `tencentcloud_kubernetes_addon` instead.
15+
1416
~> **NOTE**: Avoid to using legacy "1.0.0" version, leave the versions empty so we can fetch the latest while creating.
1517

1618
## Example Usage
1719

1820
### Install cbs addon by passing values
1921

2022
```hcl
21-
resource "tencentcloud_kubernetes_addon_attachment" "addon_cbs" {
22-
cluster_id = "cls-xxxxxxxx"
23+
resource "tencentcloud_kubernetes_addon_attachment" "example" {
24+
cluster_id = "cls-fdy7hm1q"
2325
name = "cbs"
24-
# version = "1.0.5"
26+
version = "1.1.7"
2527
values = [
2628
"rootdir=/var/lib/kubelet"
2729
]
@@ -31,8 +33,8 @@ resource "tencentcloud_kubernetes_addon_attachment" "addon_cbs" {
3133
### Install tcr addon by passing values
3234

3335
```hcl
34-
resource "tencentcloud_kubernetes_addon_attachment" "addon_tcr" {
35-
cluster_id = "cls-xxxxxxxx" #specify your tke cluster id
36+
resource "tencentcloud_kubernetes_addon_attachment" "example" {
37+
cluster_id = "cls-fdy7hm1q"
3638
name = "tcr"
3739
version = "1.0.0"
3840
values = [
@@ -53,6 +55,7 @@ resource "tencentcloud_kubernetes_addon_attachment" "addon_tcr" {
5355
"global.imagePullSecretsCrs[1].dockerServer=${local.tcr_name}.tencentcloudcr.com", #invalid format as: `${tcr_name}.tencentcloudcr.com`
5456
"global.cluster.region=gz",
5557
"global.cluster.longregion=ap-guangzhou",
58+
5659
# Specify global hosts(optional), the numbers of hosts must be matched with the numbers of imagePullSecretsCrs
5760
"global.hosts[0].domain=${local.tcr_name}-vpc.tencentcloudcr.com", #Corresponds to the dockerServer in the imagePullSecretsCrs above
5861
"global.hosts[0].ip=${local.end_point}", #input InternalEndpoint of tcr instance, you can get it from data source `tencentcloud_tcr_instances`
@@ -64,36 +67,36 @@ resource "tencentcloud_kubernetes_addon_attachment" "addon_tcr" {
6467
}
6568
6669
locals {
67-
tcr_id = tencentcloud_tcr_instance.mytcr.id
68-
tcr_name = tencentcloud_tcr_instance.mytcr.name
69-
ns_name = tencentcloud_tcr_namespace.my_ns.name
70-
user_name = tencentcloud_tcr_token.my_token.user_name
71-
token = tencentcloud_tcr_token.my_token.token
72-
end_point = data.tencentcloud_tcr_instances.my_ins.instance_list.0.internal_end_point
70+
tcr_id = tencentcloud_tcr_instance.example.id
71+
tcr_name = tencentcloud_tcr_instance.example.name
72+
ns_name = tencentcloud_tcr_namespace.example.name
73+
user_name = tencentcloud_tcr_token.example.user_name
74+
token = tencentcloud_tcr_token.example.token
75+
end_point = data.tencentcloud_tcr_instances.example.instance_list.0.internal_end_point
7376
}
7477
75-
resource "tencentcloud_tcr_token" "my_token" {
78+
resource "tencentcloud_tcr_token" "example" {
7679
instance_id = local.tcr_id
7780
description = "tcr token"
7881
}
7982
80-
data "tencentcloud_tcr_instances" "my_ins" {
83+
data "tencentcloud_tcr_instances" "example" {
8184
instance_id = local.tcr_id
8285
}
8386
84-
resource "tencentcloud_tcr_instance" "mytcr" {
85-
name = "tf-test-tcr-addon"
87+
resource "tencentcloud_tcr_instance" "example" {
88+
name = "tf-example"
8689
instance_type = "basic"
8790
delete_bucket = true
8891
8992
tags = {
90-
test = "test"
93+
createBy = "Terraform"
9194
}
9295
}
9396
94-
resource "tencentcloud_tcr_namespace" "my_ns" {
97+
resource "tencentcloud_tcr_namespace" "example" {
9598
instance_id = local.tcr_id
96-
name = "tf_test_tcr_ns_addon"
99+
name = "tf-example"
97100
is_public = true
98101
is_auto_scan = true
99102
is_prevent_vul = true
@@ -107,8 +110,9 @@ resource "tencentcloud_tcr_namespace" "my_ns" {
107110
### Install new addon by passing spec json to req_body directly
108111

109112
```hcl
110-
resource "tencentcloud_kubernetes_addon_attachment" "addon_cbs" {
111-
cluster_id = "cls-xxxxxxxx"
113+
resource "tencentcloud_kubernetes_addon_attachment" "example" {
114+
cluster_id = "cls-fdy7hm1q"
115+
name = "cbs"
112116
request_body = <<EOF
113117
{
114118
"spec":{
@@ -153,6 +157,6 @@ In addition to all arguments above, the following attributes are exported:
153157

154158
Addon can be imported by using cluster_id#addon_name
155159
```
156-
$ terraform import tencentcloud_kubernetes_addon_attachment.addon_cos cls-xxxxxxxx#cos
160+
$ terraform import tencentcloud_kubernetes_addon_attachment.example cls-fdy7hm1q#cbs
157161
```
158162

0 commit comments

Comments
 (0)