Skip to content
Merged
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/3576.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/tencentcloud_kubernetes_cluster: support `disable_addons`
```
19 changes: 18 additions & 1 deletion tencentcloud/services/tke/resource_tc_kubernetes_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -1561,6 +1561,15 @@ func ResourceTencentCloudKubernetesCluster() *schema.Resource {
Optional: true,
Description: "The strategy for deleting cluster instances: terminate (destroy instances, only support pay as you go cloud host instances) retain (remove only, keep instances), Default is terminate.",
},

"disable_addons": {
Type: schema.TypeList,
Optional: true,
Description: "To prevent the installation of a specific Addon component, enter the corresponding AddonName.",
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
},
}
}
Expand Down Expand Up @@ -1731,6 +1740,14 @@ func resourceTencentCloudKubernetesClusterCreate(d *schema.ResourceData, meta in
}
}

if v, ok := d.GetOk("disable_addons"); ok {
for _, item := range v.([]interface{}) {
if disableAddon, ok := item.(string); ok {
request.DisableAddons = append(request.DisableAddons, &disableAddon)
}
}
}

if err := resourceTencentCloudKubernetesClusterCreatePostFillRequest0(ctx, request); err != nil {
return err
}
Expand Down Expand Up @@ -1975,7 +1992,7 @@ func resourceTencentCloudKubernetesClusterUpdate(d *schema.ResourceData, meta in

ctx := tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta)

immutableArgs := []string{"cdc_id", "extension_addon"}
immutableArgs := []string{"cdc_id", "extension_addon", "disable_addons"}
for _, v := range immutableArgs {
if d.HasChange(v) {
return fmt.Errorf("argument `%s` cannot be changed", v)
Expand Down
22 changes: 22 additions & 0 deletions tencentcloud/services/tke/resource_tc_kubernetes_cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,28 @@ resource "tencentcloud_kubernetes_cluster" "example" {
}
```

Using disable addons

```hcl
resource "tencentcloud_kubernetes_cluster" "example" {
vpc_id = "vpc-i5yyodl9"
cluster_max_pod_num = 32
cluster_name = "tf-example"
cluster_desc = "cluster desc."
cluster_max_service_num = 256
cluster_version = "1.30.0"
cluster_deploy_type = "MANAGED_CLUSTER"
container_runtime = "containerd"
runtime_version = "1.6.9"
instance_delete_mode = "terminate"
upgrade_instances_follow_cluster = true
network_type = "VPC-CNI"
eni_subnet_ids = ["subnet-hhi88a58"]
service_cidr = "10.1.0.0/24"
disable_addons = ["ip-masq-agent"]
}
```

Import

tke cluster can be imported, e.g.
Expand Down
23 changes: 23 additions & 0 deletions website/docs/r/kubernetes_cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,28 @@ resource "tencentcloud_kubernetes_cluster" "example" {
}
```

### Using disable addons

```hcl
resource "tencentcloud_kubernetes_cluster" "example" {
vpc_id = "vpc-i5yyodl9"
cluster_max_pod_num = 32
cluster_name = "tf-example"
cluster_desc = "cluster desc."
cluster_max_service_num = 256
cluster_version = "1.30.0"
cluster_deploy_type = "MANAGED_CLUSTER"
container_runtime = "containerd"
runtime_version = "1.6.9"
instance_delete_mode = "terminate"
upgrade_instances_follow_cluster = true
network_type = "VPC-CNI"
eni_subnet_ids = ["subnet-hhi88a58"]
service_cidr = "10.1.0.0/24"
disable_addons = ["ip-masq-agent"]
}
```

## Argument Reference

The following arguments are supported:
Expand Down Expand Up @@ -796,6 +818,7 @@ The following arguments are supported:
* `container_runtime` - (Optional, String, ForceNew) Runtime type of the cluster, the available values include: 'docker' and 'containerd'.The Kubernetes v1.24 has removed dockershim, so please use containerd in v1.24 or higher. The default value is `docker` for versions below v1.24 and `containerd` for versions above v1.24.
* `data_plane_v2` - (Optional, Bool, ForceNew) Whether to enable DataPlaneV2 (replace kube-proxy with cilium). `data_plane_v2` and `cluster_ipvs` should not be set at the same time.
* `deletion_protection` - (Optional, Bool) Indicates whether cluster deletion protection is enabled. Default is false.
* `disable_addons` - (Optional, List: [`String`]) To prevent the installation of a specific Addon component, enter the corresponding AddonName.
* `docker_graph_path` - (Optional, String, ForceNew) Docker graph path. Default is `/var/lib/docker`.
* `enable_customized_pod_cidr` - (Optional, Bool) Whether to enable the custom mode of node podCIDR size. Default is false.
* `eni_subnet_ids` - (Optional, List: [`String`]) Subnet Ids for cluster with VPC-CNI network mode. This field can only set when field `network_type` is 'VPC-CNI'. `eni_subnet_ids` can not empty once be set.
Expand Down
Loading