Skip to content

feat: add validation checks when using existing KSA #1567

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

Closed
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
4 changes: 4 additions & 0 deletions modules/workload-identity/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ locals {

k8s_sa_project_id = var.k8s_sa_project_id != null ? var.k8s_sa_project_id : var.project_id
k8s_sa_gcp_derived_name = "serviceAccount:${local.k8s_sa_project_id}.svc.id.goog[${var.namespace}/${local.output_k8s_name}]"

# Validation checks for required variables
validate_cluster = (var.use_existing_k8s_sa && var.cluster_name == "") ? tobool("Variable 'cluster_name' is required when using existing KSA") : true
validate_location = (var.use_existing_k8s_sa && var.location == "") ? tobool("Variable 'location' is required when using existing KSA") : true
}

data "google_service_account" "cluster_service_account" {
Expand Down