Skip to content

fix(tke): [122390667] tencentcloud_kubernetes_cluster_endpoint optimize code logic and documentation #3207

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

Merged
merged 2 commits into from
Mar 14, 2025
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/3207.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/tencentcloud_kubernetes_cluster_endpoint: optimize code logic and documentation
```
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ func ResourceTencentCloudTkeClusterEndpoint() *schema.Resource {
Create: resourceTencentCloudTkeClusterEndpointCreate,
Update: resourceTencentCloudTkeClusterEndpointUpdate,
Delete: resourceTencentCloudTkeClusterEndpointDelete,
Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
},
Schema: map[string]*schema.Schema{
"cluster_id": {
Type: schema.TypeString,
Expand Down Expand Up @@ -378,6 +375,11 @@ func resourceTencentCloudTkeClusterEndpointDelete(d *schema.ResourceData, meta i
err = tencentCloudClusterIntranetSwitch(ctx, &service, id, "", false, "")
if err != nil {
errs = *multierror.Append(err)
} else {
taskErr := waitForClusterEndpointFinish(ctx, &service, id, false, false)
if taskErr != nil {
errs = *multierror.Append(taskErr)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,34 @@
Provide a resource to create a KubernetesClusterEndpoint. This resource allows you to create an empty cluster first without any workers. Only all attached node depends create complete, cluster endpoint will finally be enabled.
Provide a resource to create a kubernetes cluster endpoint. This resource allows you to create an empty cluster first without any workers. Only all attached node depends create complete, cluster endpoint will finally be enabled.

~> **NOTE:** Recommend using `depends_on` to make sure endpoint create after node pools or workers does.

Example Usage

```hcl
resource "tencentcloud_kubernetes_node_pool" "pool1" {}
Open intranet access for kubernetes cluster

resource "tencentcloud_kubernetes_cluster_endpoint" "foo" {
cluster_id = "cls-xxxxxxxx"
cluster_internet = true
cluster_intranet = true
# managed_cluster_internet_security_policies = [
"192.168.0.0/24"
]
cluster_intranet_subnet_id = "subnet-xxxxxxxx"
depends_on = [
tencentcloud_kubernetes_node_pool.pool1
]
```hcl
resource "tencentcloud_kubernetes_cluster_endpoint" "example" {
cluster_id = "cls-fdy7hm1q"
cluster_intranet = true
cluster_intranet_subnet_id = "subnet-7nl0sswi"
cluster_intranet_domain = "intranet_demo.com"
}
```

Import
Open internet access for kubernetes cluster

KubernetesClusterEndpoint instance can be imported by passing cluster id, e.g.
```hcl
resource "tencentcloud_kubernetes_cluster_endpoint" "example" {
cluster_id = "cls-fdy7hm1q"
cluster_internet = true
cluster_internet_security_group = "sg-e6a8xxib"
cluster_internet_domain = "internet_demo.com"
extensive_parameters = jsonencode({
"AddressIPVersion" : "IPV4",
"InternetAccessible" : {
"InternetChargeType" : "TRAFFIC_POSTPAID_BY_HOUR",
"InternetMaxBandwidthOut" : 10
}
})
}
```
$ terraform import tencentcloud_kubernetes_cluster_endpoint.test cluster-id
```
49 changes: 27 additions & 22 deletions website/docs/r/kubernetes_cluster_endpoint.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,43 @@ layout: "tencentcloud"
page_title: "TencentCloud: tencentcloud_kubernetes_cluster_endpoint"
sidebar_current: "docs-tencentcloud-resource-kubernetes_cluster_endpoint"
description: |-
Provide a resource to create a KubernetesClusterEndpoint. This resource allows you to create an empty cluster first without any workers. Only all attached node depends create complete, cluster endpoint will finally be enabled.
Provide a resource to create a kubernetes cluster endpoint. This resource allows you to create an empty cluster first without any workers. Only all attached node depends create complete, cluster endpoint will finally be enabled.
---

# tencentcloud_kubernetes_cluster_endpoint

Provide a resource to create a KubernetesClusterEndpoint. This resource allows you to create an empty cluster first without any workers. Only all attached node depends create complete, cluster endpoint will finally be enabled.
Provide a resource to create a kubernetes cluster endpoint. This resource allows you to create an empty cluster first without any workers. Only all attached node depends create complete, cluster endpoint will finally be enabled.

~> **NOTE:** Recommend using `depends_on` to make sure endpoint create after node pools or workers does.

## Example Usage

### Open intranet access for kubernetes cluster

```hcl
resource "tencentcloud_kubernetes_cluster_endpoint" "example" {
cluster_id = "cls-fdy7hm1q"
cluster_intranet = true
cluster_intranet_subnet_id = "subnet-7nl0sswi"
cluster_intranet_domain = "intranet_demo.com"
}
```

### Open internet access for kubernetes cluster

```hcl
resource "tencentcloud_kubernetes_node_pool" "pool1" {}

resource "tencentcloud_kubernetes_cluster_endpoint" "foo" {
cluster_id = "cls-xxxxxxxx"
cluster_internet = true
cluster_intranet = true
# managed_cluster_internet_security_policies = [
"192.168.0.0/24"
]
cluster_intranet_subnet_id = "subnet-xxxxxxxx"
depends_on = [
tencentcloud_kubernetes_node_pool.pool1
]
resource "tencentcloud_kubernetes_cluster_endpoint" "example" {
cluster_id = "cls-fdy7hm1q"
cluster_internet = true
cluster_internet_security_group = "sg-e6a8xxib"
cluster_internet_domain = "internet_demo.com"
extensive_parameters = jsonencode({
"AddressIPVersion" : "IPV4",
"InternetAccessible" : {
"InternetChargeType" : "TRAFFIC_POSTPAID_BY_HOUR",
"InternetMaxBandwidthOut" : 10
}
})
}
```

Expand Down Expand Up @@ -60,10 +72,3 @@ In addition to all arguments above, the following attributes are exported:
* `user_name` - User name of account.


## Import

KubernetesClusterEndpoint instance can be imported by passing cluster id, e.g.
```
$ terraform import tencentcloud_kubernetes_cluster_endpoint.test cluster-id
```

Loading