File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed
examples/workload_identity
modules/workload-identity Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ module "gke" {
53
53
]
54
54
}
55
55
56
+ # example without existing KSA
56
57
module "workload_identity" {
57
58
source = " ../../modules/workload-identity"
58
59
project_id = var. project_id
@@ -61,5 +62,27 @@ module "workload_identity" {
61
62
use_existing_k8s_sa = false
62
63
}
63
64
65
+
66
+ # example with existing KSA
67
+ resource "kubernetes_service_account" "test" {
68
+ metadata {
69
+ name = " foo-ksa"
70
+ }
71
+ secret {
72
+ name = " bar"
73
+ }
74
+ }
75
+
76
+ module "workload_identity_existing_ksa" {
77
+ source = " ../../modules/workload-identity"
78
+ project_id = var. project_id
79
+ name = " existing-${ module . gke . name } "
80
+ cluster_name = module. gke . name
81
+ location = module. gke . location
82
+ namespace = " default"
83
+ use_existing_k8s_sa = true
84
+ k8s_sa_name = kubernetes_service_account. test . metadata . 0 . name
85
+ }
86
+
64
87
data "google_client_config" "default" {
65
88
}
Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ module "annotate-sa" {
69
69
create_cmd_body = " ${ local . cluster_endpoint } ${ local . token } ${ local . cluster_ca_certificate } kubectl annotate --overwrite sa -n ${ local . output_k8s_namespace } ${ local . k8s_given_name } iam.gke.io/gcp-service-account=${ local . gcp_sa_email } "
70
70
71
71
destroy_cmd_entrypoint = " ${ path . module } /scripts/kubectl_wrapper.sh"
72
- destroy_cmd_body = " ${ local . cluster_endpoint } ${ local . token } ${ local . cluster_ca_certificate } kubectl annotate --overwrite sa -n ${ local . output_k8s_namespace } ${ local . k8s_given_name } iam.gke.io/gcp-service-account-"
72
+ destroy_cmd_body = " ${ local . cluster_endpoint } ${ local . token } ${ local . cluster_ca_certificate } kubectl annotate sa -n ${ local . output_k8s_namespace } ${ local . k8s_given_name } iam.gke.io/gcp-service-account-"
73
73
}
74
74
75
75
resource "google_service_account_iam_member" "main" {
You can’t perform that action at this time.
0 commit comments