Skip to content

Commit 4e4ce02

Browse files
feat: Add the option to disable Kubernetes SA annotation in workload-identity. (#787)
* Add the option to disable Kubernetes SA annotation in workload-identity. * Add the option to disable Kubernetes SA annotation in workload-identity. Generated documentation. Co-authored-by: Bharath KKB <[email protected]>
1 parent 98826e6 commit 4e4ce02

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

modules/workload-identity/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ module "my-app-workload-identity" {
6969

7070
| Name | Description | Type | Default | Required |
7171
|------|-------------|------|---------|:--------:|
72+
| annotate\_k8s\_sa | Annotate the kubernetes service account with 'iam.gke.io/gcp-service-account' annotation. Valid in cases when an existing SA is used. | `bool` | `true` | no |
7273
| automount\_service\_account\_token | Enable automatic mounting of the service account token | `bool` | `false` | no |
7374
| cluster\_name | Cluster name. Required if using existing KSA. | `string` | `""` | no |
7475
| k8s\_sa\_name | Name for the existing Kubernetes service account | `string` | `null` | no |

modules/workload-identity/main.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ module "annotate-sa" {
4949
source = "terraform-google-modules/gcloud/google//modules/kubectl-wrapper"
5050
version = "~> 2.0.2"
5151

52-
enabled = var.use_existing_k8s_sa
52+
enabled = var.use_existing_k8s_sa && var.annotate_k8s_sa
5353
skip_download = true
5454
cluster_name = var.cluster_name
5555
cluster_location = var.location

modules/workload-identity/variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ variable "use_existing_k8s_sa" {
5454
type = bool
5555
}
5656

57+
variable "annotate_k8s_sa" {
58+
description = "Annotate the kubernetes service account with 'iam.gke.io/gcp-service-account' annotation. Valid in cases when an existing SA is used."
59+
default = true
60+
type = bool
61+
}
62+
5763
variable "automount_service_account_token" {
5864
description = "Enable automatic mounting of the service account token"
5965
default = false

0 commit comments

Comments
 (0)