Skip to content

Instantly share code, notes, and snippets.

@damlys
Last active May 15, 2023 17:24
Show Gist options
  • Save damlys/036b6a0100d9786283915a2139f711df to your computer and use it in GitHub Desktop.
Save damlys/036b6a0100d9786283915a2139f711df to your computer and use it in GitHub Desktop.
Terraform GKE providers
variable "google_client_config" {
description = "https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/client_config"
type = object({
access_token = string
})
}
variable "google_container_cluster" {
description = "https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/container_cluster"
type = object({
endpoint = string
master_auth = list(object({
cluster_ca_certificate = string
}))
})
}
provider "kubernetes" {
host = "https://${var.google_container_cluster.endpoint}"
token = var.google_client_config.access_token
cluster_ca_certificate = base64decode(var.google_container_cluster.master_auth[0].cluster_ca_certificate)
}
provider "helm" {
kubernetes {
host = "https://${var.google_container_cluster.endpoint}"
token = var.google_client_config.access_token
cluster_ca_certificate = base64decode(var.google_container_cluster.master_auth[0].cluster_ca_certificate)
}
registry {
url = "oci://europe-central2-docker.pkg.dev/goidp-general-0/private-helm-charts"
username = "oauth2accesstoken"
password = var.google_client_config.access_token
}
registry {
url = "oci://europe-central2-docker.pkg.dev/goidp-general-0/public-helm-charts"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment