Skip to content

Commit 3e872aa

Browse files
authored
fix(tke): [122438066] tencentcloud_kubernetes_cluster_endpoint add kube_config, kube_config_intranet fields output (#3225)
* add * add
1 parent 1b11b4b commit 3e872aa

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed

.changelog/3225.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
resource/tencentcloud_kubernetes_cluster_endpoint: add `kube_config`, `kube_config_intranet` fields output
3+
```

tencentcloud/services/tke/resource_tc_kubernetes_cluster_endpoint.go

+49
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,16 @@ func ResourceTencentCloudTkeClusterEndpoint() *schema.Resource {
115115
Computed: true,
116116
Description: "The Intranet address used for access.",
117117
},
118+
"kube_config": {
119+
Type: schema.TypeString,
120+
Computed: true,
121+
Description: "The Intranet address used for access.",
122+
},
123+
"kube_config_intranet": {
124+
Type: schema.TypeString,
125+
Computed: true,
126+
Description: "Kubernetes config of private network.",
127+
},
118128
},
119129
}
120130
}
@@ -169,6 +179,45 @@ func resourceTencentCloudTkeClusterEndpointRead(d *schema.ResourceData, meta int
169179
// _ = d.Set("managed_cluster_internet_security_policies", security.SecurityPolicy)
170180
//}
171181

182+
var config string
183+
clusterInternet := d.Get("cluster_internet").(bool)
184+
clusterIntranet := d.Get("cluster_intranet").(bool)
185+
if clusterInternet {
186+
err = resource.Retry(tccommon.ReadRetryTimeout, func() *resource.RetryError {
187+
result, e := service.DescribeClusterConfig(ctx, id, true)
188+
if e != nil {
189+
return tccommon.RetryError(e)
190+
}
191+
192+
config = result
193+
return nil
194+
})
195+
196+
if err != nil {
197+
return err
198+
}
199+
200+
_ = d.Set("kube_config", config)
201+
}
202+
203+
if clusterIntranet {
204+
err = resource.Retry(tccommon.ReadRetryTimeout, func() *resource.RetryError {
205+
result, e := service.DescribeClusterConfig(ctx, id, false)
206+
if e != nil {
207+
return tccommon.RetryError(e)
208+
}
209+
210+
config = result
211+
return nil
212+
})
213+
214+
if err != nil {
215+
return err
216+
}
217+
218+
_ = d.Set("kube_config_intranet", config)
219+
}
220+
172221
return nil
173222
}
174223

website/docs/r/kubernetes_cluster_endpoint.html.markdown

+2
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ In addition to all arguments above, the following attributes are exported:
6767
* `cluster_deploy_type` - Cluster deploy type of `MANAGED_CLUSTER` or `INDEPENDENT_CLUSTER`.
6868
* `cluster_external_endpoint` - External network address to access.
6969
* `domain` - Domain name for access.
70+
* `kube_config_intranet` - Kubernetes config of private network.
71+
* `kube_config` - The Intranet address used for access.
7072
* `password` - Password of account.
7173
* `pgw_endpoint` - The Intranet address used for access.
7274
* `user_name` - User name of account.

0 commit comments

Comments
 (0)