Skip to content

fix(tke): [122438066] tencentcloud_kubernetes_cluster_endpoint add kube_config, kube_config_intranet fields output #3225

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 19, 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/3225.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/tencentcloud_kubernetes_cluster_endpoint: add `kube_config`, `kube_config_intranet` fields output
```
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,16 @@ func ResourceTencentCloudTkeClusterEndpoint() *schema.Resource {
Computed: true,
Description: "The Intranet address used for access.",
},
"kube_config": {
Type: schema.TypeString,
Computed: true,
Description: "The Intranet address used for access.",
},
"kube_config_intranet": {
Type: schema.TypeString,
Computed: true,
Description: "Kubernetes config of private network.",
},
},
}
}
Expand Down Expand Up @@ -169,6 +179,45 @@ func resourceTencentCloudTkeClusterEndpointRead(d *schema.ResourceData, meta int
// _ = d.Set("managed_cluster_internet_security_policies", security.SecurityPolicy)
//}

var config string
clusterInternet := d.Get("cluster_internet").(bool)
clusterIntranet := d.Get("cluster_intranet").(bool)
if clusterInternet {
err = resource.Retry(tccommon.ReadRetryTimeout, func() *resource.RetryError {
result, e := service.DescribeClusterConfig(ctx, id, true)
if e != nil {
return tccommon.RetryError(e)
}

config = result
return nil
})

if err != nil {
return err
}

_ = d.Set("kube_config", config)
}

if clusterIntranet {
err = resource.Retry(tccommon.ReadRetryTimeout, func() *resource.RetryError {
result, e := service.DescribeClusterConfig(ctx, id, false)
if e != nil {
return tccommon.RetryError(e)
}

config = result
return nil
})

if err != nil {
return err
}

_ = d.Set("kube_config_intranet", config)
}

return nil
}

Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/kubernetes_cluster_endpoint.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ In addition to all arguments above, the following attributes are exported:
* `cluster_deploy_type` - Cluster deploy type of `MANAGED_CLUSTER` or `INDEPENDENT_CLUSTER`.
* `cluster_external_endpoint` - External network address to access.
* `domain` - Domain name for access.
* `kube_config_intranet` - Kubernetes config of private network.
* `kube_config` - The Intranet address used for access.
* `password` - Password of account.
* `pgw_endpoint` - The Intranet address used for access.
* `user_name` - User name of account.
Expand Down
Loading