Skip to content

fix(tke): [124743081] Deprecated resourace tencentcloud_kubernetes_addon_attachment #3412

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/3412.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/tencentcloud_kubernetes_addon_attachment: has been deprecated
```

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
Provide a resource to configure kubernetes cluster app addons.

~> **NOTE**: This resource has been deprecated in Terraform TencentCloud provider version 1.81.200. Please use `tencentcloud_kubernetes_addon` instead.

~> **NOTE**: Avoid to using legacy "1.0.0" version, leave the versions empty so we can fetch the latest while creating.

Example Usage

Install cbs addon by passing values

```hcl

resource "tencentcloud_kubernetes_addon_attachment" "addon_cbs" {
cluster_id = "cls-xxxxxxxx"
name = "cbs"
# version = "1.0.5"
resource "tencentcloud_kubernetes_addon_attachment" "example" {
cluster_id = "cls-fdy7hm1q"
name = "cbs"
version = "1.1.7"
values = [
"rootdir=/var/lib/kubelet"
]
Expand All @@ -21,8 +22,8 @@ resource "tencentcloud_kubernetes_addon_attachment" "addon_cbs" {
Install tcr addon by passing values

```hcl
resource "tencentcloud_kubernetes_addon_attachment" "addon_tcr" {
cluster_id = "cls-xxxxxxxx" #specify your tke cluster id
resource "tencentcloud_kubernetes_addon_attachment" "example" {
cluster_id = "cls-fdy7hm1q"
name = "tcr"
version = "1.0.0"
values = [
Expand All @@ -43,47 +44,48 @@ resource "tencentcloud_kubernetes_addon_attachment" "addon_tcr" {
"global.imagePullSecretsCrs[1].dockerServer=${local.tcr_name}.tencentcloudcr.com", #invalid format as: `${tcr_name}.tencentcloudcr.com`
"global.cluster.region=gz",
"global.cluster.longregion=ap-guangzhou",

# Specify global hosts(optional), the numbers of hosts must be matched with the numbers of imagePullSecretsCrs
"global.hosts[0].domain=${local.tcr_name}-vpc.tencentcloudcr.com", #Corresponds to the dockerServer in the imagePullSecretsCrs above
"global.hosts[0].ip=${local.end_point}", #input InternalEndpoint of tcr instance, you can get it from data source `tencentcloud_tcr_instances`
"global.hosts[0].disabled=false", #disabled this host config or not
"global.hosts[0].domain=${local.tcr_name}-vpc.tencentcloudcr.com", #Corresponds to the dockerServer in the imagePullSecretsCrs above
"global.hosts[0].ip=${local.end_point}", #input InternalEndpoint of tcr instance, you can get it from data source `tencentcloud_tcr_instances`
"global.hosts[0].disabled=false", #disabled this host config or not
"global.hosts[1].domain=${local.tcr_name}.tencentcloudcr.com",
"global.hosts[1].ip=${local.end_point}",
"global.hosts[1].disabled=false",
]
}

locals {
tcr_id = tencentcloud_tcr_instance.mytcr.id
tcr_name = tencentcloud_tcr_instance.mytcr.name
ns_name = tencentcloud_tcr_namespace.my_ns.name
user_name = tencentcloud_tcr_token.my_token.user_name
token = tencentcloud_tcr_token.my_token.token
end_point = data.tencentcloud_tcr_instances.my_ins.instance_list.0.internal_end_point
tcr_id = tencentcloud_tcr_instance.example.id
tcr_name = tencentcloud_tcr_instance.example.name
ns_name = tencentcloud_tcr_namespace.example.name
user_name = tencentcloud_tcr_token.example.user_name
token = tencentcloud_tcr_token.example.token
end_point = data.tencentcloud_tcr_instances.example.instance_list.0.internal_end_point
}

resource "tencentcloud_tcr_token" "my_token" {
resource "tencentcloud_tcr_token" "example" {
instance_id = local.tcr_id
description = "tcr token"
}

data "tencentcloud_tcr_instances" "my_ins" {
data "tencentcloud_tcr_instances" "example" {
instance_id = local.tcr_id
}

resource "tencentcloud_tcr_instance" "mytcr" {
name = "tf-test-tcr-addon"
resource "tencentcloud_tcr_instance" "example" {
name = "tf-example"
instance_type = "basic"
delete_bucket = true

tags = {
test = "test"
createBy = "Terraform"
}
}

resource "tencentcloud_tcr_namespace" "my_ns" {
resource "tencentcloud_tcr_namespace" "example" {
instance_id = local.tcr_id
name = "tf_test_tcr_ns_addon"
name = "tf-example"
is_public = true
is_auto_scan = true
is_prevent_vul = true
Expand All @@ -97,8 +99,9 @@ resource "tencentcloud_tcr_namespace" "my_ns" {
Install new addon by passing spec json to req_body directly

```hcl
resource "tencentcloud_kubernetes_addon_attachment" "addon_cbs" {
cluster_id = "cls-xxxxxxxx"
resource "tencentcloud_kubernetes_addon_attachment" "example" {
cluster_id = "cls-fdy7hm1q"
name = "cbs"
request_body = <<EOF
{
"spec":{
Expand All @@ -122,5 +125,5 @@ Import

Addon can be imported by using cluster_id#addon_name
```
$ terraform import tencentcloud_kubernetes_addon_attachment.addon_cos cls-xxxxxxxx#cos
```
$ terraform import tencentcloud_kubernetes_addon_attachment.example cls-fdy7hm1q#cbs
```
46 changes: 25 additions & 21 deletions website/docs/r/kubernetes_addon_attachment.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,19 @@ description: |-

Provide a resource to configure kubernetes cluster app addons.

~> **NOTE**: This resource has been deprecated in Terraform TencentCloud provider version 1.81.200. Please use `tencentcloud_kubernetes_addon` instead.

~> **NOTE**: Avoid to using legacy "1.0.0" version, leave the versions empty so we can fetch the latest while creating.

## Example Usage

### Install cbs addon by passing values

```hcl
resource "tencentcloud_kubernetes_addon_attachment" "addon_cbs" {
cluster_id = "cls-xxxxxxxx"
resource "tencentcloud_kubernetes_addon_attachment" "example" {
cluster_id = "cls-fdy7hm1q"
name = "cbs"
# version = "1.0.5"
version = "1.1.7"
values = [
"rootdir=/var/lib/kubelet"
]
Expand All @@ -31,8 +33,8 @@ resource "tencentcloud_kubernetes_addon_attachment" "addon_cbs" {
### Install tcr addon by passing values

```hcl
resource "tencentcloud_kubernetes_addon_attachment" "addon_tcr" {
cluster_id = "cls-xxxxxxxx" #specify your tke cluster id
resource "tencentcloud_kubernetes_addon_attachment" "example" {
cluster_id = "cls-fdy7hm1q"
name = "tcr"
version = "1.0.0"
values = [
Expand All @@ -53,6 +55,7 @@ resource "tencentcloud_kubernetes_addon_attachment" "addon_tcr" {
"global.imagePullSecretsCrs[1].dockerServer=${local.tcr_name}.tencentcloudcr.com", #invalid format as: `${tcr_name}.tencentcloudcr.com`
"global.cluster.region=gz",
"global.cluster.longregion=ap-guangzhou",

# Specify global hosts(optional), the numbers of hosts must be matched with the numbers of imagePullSecretsCrs
"global.hosts[0].domain=${local.tcr_name}-vpc.tencentcloudcr.com", #Corresponds to the dockerServer in the imagePullSecretsCrs above
"global.hosts[0].ip=${local.end_point}", #input InternalEndpoint of tcr instance, you can get it from data source `tencentcloud_tcr_instances`
Expand All @@ -64,36 +67,36 @@ resource "tencentcloud_kubernetes_addon_attachment" "addon_tcr" {
}

locals {
tcr_id = tencentcloud_tcr_instance.mytcr.id
tcr_name = tencentcloud_tcr_instance.mytcr.name
ns_name = tencentcloud_tcr_namespace.my_ns.name
user_name = tencentcloud_tcr_token.my_token.user_name
token = tencentcloud_tcr_token.my_token.token
end_point = data.tencentcloud_tcr_instances.my_ins.instance_list.0.internal_end_point
tcr_id = tencentcloud_tcr_instance.example.id
tcr_name = tencentcloud_tcr_instance.example.name
ns_name = tencentcloud_tcr_namespace.example.name
user_name = tencentcloud_tcr_token.example.user_name
token = tencentcloud_tcr_token.example.token
end_point = data.tencentcloud_tcr_instances.example.instance_list.0.internal_end_point
}

resource "tencentcloud_tcr_token" "my_token" {
resource "tencentcloud_tcr_token" "example" {
instance_id = local.tcr_id
description = "tcr token"
}

data "tencentcloud_tcr_instances" "my_ins" {
data "tencentcloud_tcr_instances" "example" {
instance_id = local.tcr_id
}

resource "tencentcloud_tcr_instance" "mytcr" {
name = "tf-test-tcr-addon"
resource "tencentcloud_tcr_instance" "example" {
name = "tf-example"
instance_type = "basic"
delete_bucket = true

tags = {
test = "test"
createBy = "Terraform"
}
}

resource "tencentcloud_tcr_namespace" "my_ns" {
resource "tencentcloud_tcr_namespace" "example" {
instance_id = local.tcr_id
name = "tf_test_tcr_ns_addon"
name = "tf-example"
is_public = true
is_auto_scan = true
is_prevent_vul = true
Expand All @@ -107,8 +110,9 @@ resource "tencentcloud_tcr_namespace" "my_ns" {
### Install new addon by passing spec json to req_body directly

```hcl
resource "tencentcloud_kubernetes_addon_attachment" "addon_cbs" {
cluster_id = "cls-xxxxxxxx"
resource "tencentcloud_kubernetes_addon_attachment" "example" {
cluster_id = "cls-fdy7hm1q"
name = "cbs"
request_body = <<EOF
{
"spec":{
Expand Down Expand Up @@ -153,6 +157,6 @@ In addition to all arguments above, the following attributes are exported:

Addon can be imported by using cluster_id#addon_name
```
$ terraform import tencentcloud_kubernetes_addon_attachment.addon_cos cls-xxxxxxxx#cos
$ terraform import tencentcloud_kubernetes_addon_attachment.example cls-fdy7hm1q#cbs
```

Loading