Skip to content

Commit 463c279

Browse files
committed
fix(kube): Add documentation for kubeconfig_attributes
1 parent 6bea1df commit 463c279

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

website/docs/r/cloud_project_kube.html.markdown

+53
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,59 @@ resource "local_file" "kubeconfig" {
3737
}
3838
```
3939

40+
Create a simple Kubernetes cluster in `GRA7` region and read kubeconfig attributes:
41+
42+
-> Sensitive attributes cannot be displayed using `terraform ouput` command. You need to specify the output's name: `terraform ouput mycluster-host`.
43+
44+
```hcl
45+
resource "ovh_cloud_project_kube" "mycluster" {
46+
service_name = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
47+
name = "my_kube_cluster"
48+
region = "GRA7"
49+
}
50+
51+
output "mycluster-host" {
52+
value = ovh_cloud_project_kube.mycluster.kubeconfig_attributes[0].host
53+
sensitive = true
54+
}
55+
56+
output "mycluster-cluster-ca-certificate" {
57+
value = ovh_cloud_project_kube.mycluster.kubeconfig_attributes[0].cluster_ca_certificate
58+
sensitive = true
59+
}
60+
61+
output "mycluster-client-certificate" {
62+
value = ovh_cloud_project_kube.mycluster.kubeconfig_attributes[0].client_certificate
63+
sensitive = true
64+
}
65+
66+
output "mycluster-client-key" {
67+
value = ovh_cloud_project_kube.mycluster.kubeconfig_attributes[0].client_key
68+
sensitive = true
69+
}
70+
```
71+
72+
Create a simple Kubernetes cluster in `GRA7` region and use kubeconfig with [Helm provider](https://registry.terraform.io/providers/hashicorp/helm/latest/docs):
73+
74+
```hcl
75+
resource "ovh_cloud_project_kube" "mycluster" {
76+
service_name = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
77+
name = "my_kube_cluster"
78+
region = "GRA7"
79+
}
80+
81+
provider "helm" {
82+
kubernetes {
83+
host = ovh_cloud_project_kube.mycluster.kubeconfig_attributes[0].host
84+
client_certificate = ovh_cloud_project_kube.mycluster.kubeconfig_attributes[0].client_certificate
85+
client_key = ovh_cloud_project_kube.mycluster.kubeconfig_attributes[0].client_key
86+
cluster_ca_certificate = ovh_cloud_project_kube.mycluster.kubeconfig_attributes[0].cluster_ca_certificate
87+
}
88+
}
89+
90+
# Ready to use Helm provider
91+
```
92+
4093
Create a Kubernetes cluster in `GRA5` region with API Server AdmissionPlugins configuration:
4194

4295
```hcl

0 commit comments

Comments
 (0)