Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/base/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ module "k8s" {
# ######################################################################
module "res_defs" {
source = "../htc_res_defs"
k8s_cluster_name = var.gke_cluster_name
k8s_cluster_name = module.k8s.cluster_name
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed to ensure the cluster isn't destroyed before the cluster resource definition is to allow Humanitec to properly cleanup all apps depending on this cluster.

k8s_loadbalancer = module.k8s.loadbalancer
k8s_region = var.region
k8s_project_id = var.project_id
Expand Down
2 changes: 2 additions & 0 deletions modules/gke/gsas.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,6 @@ resource "google_project_iam_member" "gke_admin" {
# https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/google_service_account_key#private_key
resource "google_service_account_key" "gke_cluster_access_key" {
service_account_id = google_service_account.gke_cluster_access.name

depends_on = [google_project_iam_member.gke_admin]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is needed to ensure the service account roles aren't destroy when the keys are still used as otherwise cleanup operations might fail.

}
6 changes: 6 additions & 0 deletions modules/gke/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
output "loadbalancer" {
value = google_compute_address.public_ingress.address

depends_on = [helm_release.ingress_nginx]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The loadbalancer only works when ingress-nginx is provisioned.

}

output "project_id" {
Expand All @@ -23,6 +25,10 @@ output "credentials" {
sensitive = true
}

output "cluster_name" {
value = google_container_cluster.gke.name
}

output "gar_repository_id" {
value = var.gar_repository_id == null ? "" : google_artifact_registry_repository.repo[0].id
}