You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/data-sources/kubernetes_cluster_kubeconfig.md
+13-62
Original file line number
Diff line number
Diff line change
@@ -8,76 +8,27 @@ description: |-
8
8
9
9
# mgc_kubernetes_cluster_kubeconfig (Data Source)
10
10
11
-
Retrieves the kubeconfig for a specified Kubernetes cluster using its unique identifier.
12
-
13
-
## Schema
14
-
15
-
### Required
16
-
17
-
-**`cluster_id`** (String): The unique identifier of the Kubernetes cluster. This is used to fetch the corresponding kubeconfig.
18
-
19
-
### Read-Only
20
-
21
-
-**`kubeconfig`** (String): The kubeconfig of the specified Kubernetes cluster. This contains all necessary details to connect to your Kubernetes cluster, including API server addresses and authentication details.
11
+
Get the kubeconfig of a Kubernetes cluster by cluster_id.
22
12
23
13
## Example Usage
24
14
25
-
The following example demonstrates how to use this data source to retrieve the kubeconfig for a Kubernetes cluster and then save it as a local file. This is particularly useful for configuring Kubernetes clients or CI/CD pipelines that need to interact with your cluster.
26
-
27
-
```hcl
28
-
terraform {
29
-
required_providers {
30
-
mgc = {
31
-
source = "registry.terraform.io/magalucloud/mgc"
32
-
}
33
-
local = {
34
-
source = "hashicorp/local"
35
-
version = "2.5.1"
36
-
}
37
-
}
15
+
```terraform
16
+
data "mgc_kubernetes_cluster" "cluster" {
17
+
id = mgc_kubernetes_cluster.my_cluster.id
38
18
}
39
19
40
-
provider "mgc" {
41
-
alias = "sudeste"
42
-
region = "br-se1"
43
-
api_key = "YOUR_API_KEY"
20
+
output "cluster" {
21
+
value = data.mgc_kubernetes_cluster.cluster
44
22
}
23
+
```
45
24
46
-
# Fetch the kubeconfig for the specified Kubernetes cluster
47
-
data "mgc_kubernetes_cluster_kubeconfig" "cluster" {
0 commit comments