Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modifications related to autopilot and workload identity. Added workl… #1171

Merged
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
Modifications related to autopilot and workload identity. Added workl…
…oad_identity_pool output to module
  • Loading branch information
apichick committed Feb 24, 2023
commit ae6080ebf7a1c92a740cad2149c52d94481f9388
4 changes: 2 additions & 2 deletions modules/gke-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ module "cluster-autopilot" {
master_ipv4_cidr_block = "192.168.0.0/28"
}
enable_features = {
autopilot = true
workload_identity = false
autopilot = true
}
}
# tftest modules=1 resources=1 inventory=autopilot.yaml
Expand Down Expand Up @@ -162,5 +161,6 @@ module "cluster-1" {
| [name](outputs.tf#L49) | Cluster name. | |
| [notifications](outputs.tf#L54) | GKE PubSub notifications topic. | |
| [self_link](outputs.tf#L59) | Cluster self link. | ✓ |
| [workload_identity_pool](outputs.tf#L65) | Workload identity pool. | |

<!-- END TFDOC -->
2 changes: 1 addition & 1 deletion modules/gke-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ resource "google_container_cluster" "cluster" {
}

dynamic "workload_identity_config" {
for_each = var.enable_features.workload_identity ? [""] : []
for_each = (var.enable_features.workload_identity && !var.enable_features.autopilot) ? [""] : []
content {
workload_pool = "${var.project_id}.svc.id.goog"
}
Expand Down
8 changes: 8 additions & 0 deletions modules/gke-cluster/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,11 @@ output "self_link" {
sensitive = true
value = google_container_cluster.cluster.self_link
}

output "workload_identity_pool" {
description = "Workload identity pool."
value = "${var.project_id}.svc.id.goog"
depends_on = [
google_container_cluster.cluster
]
}