Skip to content

Commit a6dce1a

Browse files
apeabodybharathkkb
andauthored
feat: add module_depends_on to workload-identity (#1341)
Co-authored-by: Bharath KKB <[email protected]>
1 parent 300eb1f commit a6dce1a

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

modules/workload-identity/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ already bear the `"iam.gke.io/gcp-service-account"` annotation.
105105
| k8s\_sa\_name | Name for the Kubernetes service account; overrides `var.name`. `cluster_name` and `location` must be set when this input is specified. | `string` | `null` | no |
106106
| k8s\_sa\_project\_id | GCP project ID of the k8s service account; overrides `var.project_id`. | `string` | `null` | no |
107107
| location | Cluster location (region if regional cluster, zone if zonal cluster). Required if using existing KSA. | `string` | `""` | no |
108+
| module\_depends\_on | List of modules or resources to depend on before annotating KSA. If multiple, all items must be the same type. | `list(any)` | `[]` | no |
108109
| name | Name for both service accounts. The GCP SA will be truncated to the first 30 chars if necessary. | `string` | n/a | yes |
109110
| namespace | Namespace for the Kubernetes service account | `string` | `"default"` | no |
110111
| project\_id | GCP project ID | `string` | n/a | yes |

modules/workload-identity/main.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ module "annotate-sa" {
7272

7373
kubectl_create_command = "kubectl annotate --overwrite sa -n ${local.output_k8s_namespace} ${local.k8s_given_name} iam.gke.io/gcp-service-account=${local.gcp_sa_email}"
7474
kubectl_destroy_command = "kubectl annotate sa -n ${local.output_k8s_namespace} ${local.k8s_given_name} iam.gke.io/gcp-service-account-"
75+
76+
module_depends_on = var.module_depends_on
7577
}
7678

7779
resource "google_service_account_iam_member" "main" {

modules/workload-identity/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,9 @@ variable "use_existing_context" {
101101
type = bool
102102
default = false
103103
}
104+
105+
variable "module_depends_on" {
106+
description = "List of modules or resources to depend on before annotating KSA. If multiple, all items must be the same type."
107+
type = list(any)
108+
default = []
109+
}

0 commit comments

Comments
 (0)