Skip to content

Commit 32b91de

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

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

website/docs/r/cloud_project_kube.html.markdown

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

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

4299
```hcl

0 commit comments

Comments
 (0)