From 240e339c8789bcf9f05ca7ea00dcdde1dcef51a7 Mon Sep 17 00:00:00 2001 From: SevenEarth <391613297@qq.com> Date: Thu, 12 Jun 2025 14:49:49 +0800 Subject: [PATCH 1/2] add --- ...resource_tc_kubernetes_addon_attachment.go | 9 +-- ...resource_tc_kubernetes_addon_attachment.md | 57 ++++++++++--------- .../kubernetes_addon_attachment.html.markdown | 46 ++++++++------- 3 files changed, 60 insertions(+), 52 deletions(-) diff --git a/tencentcloud/services/tke/resource_tc_kubernetes_addon_attachment.go b/tencentcloud/services/tke/resource_tc_kubernetes_addon_attachment.go index 7d1c3fa096..20afcb11dc 100644 --- a/tencentcloud/services/tke/resource_tc_kubernetes_addon_attachment.go +++ b/tencentcloud/services/tke/resource_tc_kubernetes_addon_attachment.go @@ -17,10 +17,11 @@ import ( func ResourceTencentCloudKubernetesAddonAttachment() *schema.Resource { return &schema.Resource{ - Create: resourceTencentCloudKubernetesAddonAttachmentCreate, - Read: resourceTencentCloudKubernetesAddonAttachmentRead, - Update: resourceTencentCloudKubernetesAddonAttachmentUpdate, - Delete: resourceTencentCloudKubernetesAddonAttachmentDelete, + DeprecationMessage: "This resource has been deprecated in Terraform TencentCloud provider version 1.81.200. Please use 'tencentcloud_kubernetes_addon' instead.", + Create: resourceTencentCloudKubernetesAddonAttachmentCreate, + Read: resourceTencentCloudKubernetesAddonAttachmentRead, + Update: resourceTencentCloudKubernetesAddonAttachmentUpdate, + Delete: resourceTencentCloudKubernetesAddonAttachmentDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, }, diff --git a/tencentcloud/services/tke/resource_tc_kubernetes_addon_attachment.md b/tencentcloud/services/tke/resource_tc_kubernetes_addon_attachment.md index 2e8cf74754..ace8f07aa9 100644 --- a/tencentcloud/services/tke/resource_tc_kubernetes_addon_attachment.md +++ b/tencentcloud/services/tke/resource_tc_kubernetes_addon_attachment.md @@ -1,5 +1,7 @@ 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 @@ -7,11 +9,10 @@ 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" ] @@ -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 = [ @@ -43,10 +44,11 @@ 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", @@ -54,36 +56,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 @@ -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 = < **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 @@ -18,10 +20,10 @@ Provide a resource to configure kubernetes cluster app addons. ### 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" ] @@ -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 = [ @@ -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` @@ -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 @@ -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 = < Date: Thu, 12 Jun 2025 14:53:34 +0800 Subject: [PATCH 2/2] add --- .changelog/3412.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/3412.txt diff --git a/.changelog/3412.txt b/.changelog/3412.txt new file mode 100644 index 0000000000..d78732c27c --- /dev/null +++ b/.changelog/3412.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/tencentcloud_kubernetes_addon_attachment: has been deprecated +```