Skip to content

Commit

Permalink
added output extras to utilize with token auth (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
pgvishnuram authored Sep 29, 2021
1 parent 83c3282 commit 9f7bc81
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
13 changes: 9 additions & 4 deletions locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@ data "google_compute_instance" "sample_instance" {
}

locals {
project = data.google_compute_zones.available.project
region = data.google_compute_zones.available.region
zone = data.google_compute_zones.available.names[0]
location = var.zonal_cluster ? local.zone : local.region
project = data.google_compute_zones.available.project
region = data.google_compute_zones.available.region
zone = data.google_compute_zones.available.names[0]
location = var.zonal_cluster ? local.zone : local.region
cluster_name = google_container_cluster.primary.name
endpoint = google_container_cluster.primary.endpoint
cluster_ca_certificate = google_container_cluster.primary.master_auth[0].cluster_ca_certificate
# basic auth kubeconfig method will be removed in future release
# we will moving to token based auth method
kubeconfig = <<EOF
apiVersion: v1
clusters:
Expand Down
16 changes: 16 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
output "cluster_name" {
description = "cluster name"
value = local.cluster_name
}

output "endpoint" {
sensitive = true
description = "cluster endpoint"
value = local.endpoint
}

output "ca_certificate" {
sensitive = true
value = local.cluster_ca_certificate
}

output "bastion_proxy_command" {
value = length(google_compute_instance.bastion) > 0 ? "gcloud beta compute ssh --zone ${element(concat(google_compute_instance.bastion.*.zone, list("")), 0)} ${element(concat(google_compute_instance.bastion.*.name, list("")), 0)} --tunnel-through-iap --ssh-flag='-L 1234:127.0.0.1:8888 -C -N'" : "Not applicable - no bastion"
}
Expand Down

0 comments on commit 9f7bc81

Please sign in to comment.