Skip to content

Commit a95012b

Browse files
committed
feat: Workload identity for GKE
1 parent a806477 commit a95012b

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

modules/clickhouse_backup/iam.tf

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,3 @@ resource "google_project_iam_member" "clickhouse" {
2020
member = "serviceAccount:${google_service_account.clickhouse.email}"
2121
}
2222

23-
resource "google_service_account_key" "clickhouse" {
24-
count = var.clickhouse_get_backup_sa_from_secrets_yaml ? 0 : 1
25-
service_account_id = resource.google_service_account.clickhouse.id
26-
}

modules/clickhouse_backup/outputs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ output "clickhouse_gcs_bucket" {
33
}
44

55
output "clickhouse_backup_sa" {
6-
value = var.clickhouse_get_backup_sa_from_secrets_yaml ? var.clickhouse_backup_sa_key : one(resource.google_service_account_key.clickhouse[*].private_key)
6+
value = resource.google_service_account.clickhouse.account_id
77
}

modules/gke/main.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ resource "google_container_cluster" "default" {
2020
project = var.project_id
2121
network = var.vpc_id
2222
subnetwork = var.subnetwork
23+
location = var.azs[0]
2324
min_master_version = data.google_container_engine_versions.cluster.latest_master_version
2425

2526
networking_mode = "VPC_NATIVE"
@@ -120,6 +121,10 @@ resource "google_container_cluster" "default" {
120121
autoscaling_profile = "OPTIMIZE_UTILIZATION"
121122
}
122123

124+
workload_identity_config {
125+
workload_pool = "${var.project_id}.svc.id.goog"
126+
}
127+
123128
deletion_protection = var.k8s_deletion_protection
124129
}
125130

0 commit comments

Comments
 (0)