Skip to content

Commit

Permalink
use templatefile() (hashicorp#2423)
Browse files Browse the repository at this point in the history
  • Loading branch information
BBBmau authored Feb 14, 2024
1 parent 0efec8b commit b0aa8a4
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions _examples/google-gke-nfs-filestore/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -92,22 +92,16 @@ resource "google_filestore_instance" "test" {
}
}

data "template_file" "kubeconfig" {
template = file("${path.module}/kubeconfig-template.yaml")

vars = {
resource "local_file" "kubeconfig" {
content = templatefile("${path.module}/kubeconfig-template.yaml",{
cluster_name = google_container_cluster.primary.name
user_name = google_container_cluster.primary.master_auth[0].username
user_password = google_container_cluster.primary.master_auth[0].password
endpoint = google_container_cluster.primary.endpoint
cluster_ca = google_container_cluster.primary.master_auth[0].cluster_ca_certificate
client_cert = google_container_cluster.primary.master_auth[0].client_certificate
client_cert_key = google_container_cluster.primary.master_auth[0].client_key
}
}

resource "local_file" "kubeconfig" {
content = data.template_file.kubeconfig.rendered
})
filename = "${path.module}/kubeconfig"
}

Expand Down

0 comments on commit b0aa8a4

Please sign in to comment.