-
-
Save ctrox/d31751829062d650b6d43443d6f8aed3 to your computer and use it in GitHub Desktop.
Nine Terraform example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "kubernetes_manifest" "sample_cluster" { | |
manifest = { | |
apiVersion = "infrastructure.nine.ch/v1alpha1" | |
kind = "KubernetesCluster" | |
metadata = { | |
name = "sample-cluster" | |
namespace = "<cockpit account name>" | |
} | |
spec = { | |
forProvider = { | |
vcluster = { | |
version = "1.24" | |
} | |
nodePools = [] | |
location = "nine-es34" | |
} | |
writeConnectionSecretToRef = { | |
name = "sample-cluster" | |
namespace = "<cockpit account name>" | |
} | |
} | |
} | |
wait { | |
condition { | |
type = "Ready" | |
status = "True" | |
} | |
} | |
} | |
# read secret that the KubernetesCluster creates | |
data "kubernetes_secret_v1" "example_sa" { | |
metadata { | |
name = kubernetes_manifest.sample_cluster.manifest.spec.writeConnectionSecretToRef.name | |
namespace = kubernetes_manifest.sample_cluster.manifest.spec.writeConnectionSecretToRef.namespace | |
} | |
} | |
# put token into an output. This could then be used by another module for example. | |
output "kubeconfig" { | |
sensitive = true | |
value = data.kubernetes_secret_v1.sample_cluster.data.kubeconfig | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment