File tree Expand file tree Collapse file tree 4 files changed +5
-56
lines changed
modules/workload-identity Expand file tree Collapse file tree 4 files changed +5
-56
lines changed Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ module "my-app-workload-identity" {
72
72
| cluster\_ name | Cluster name. Required if using existing KSA. | string | ` "" ` | no |
73
73
| k8s\_ sa\_ name | Name for the existing Kubernetes service account | string | ` "null" ` | no |
74
74
| location | Cluster location (region if regional cluster, zone if zonal cluster). Required if using existing KSA. | string | ` "" ` | no |
75
- | name | Name for both service accounts | string | n/a | yes |
75
+ | name | Name for both service accounts. The GCP SA will be truncated to the first 30 chars if necessary. | string | n/a | yes |
76
76
| namespace | Namespace for k8s service account | string | ` "default" ` | no |
77
77
| project\_ id | GCP project ID | string | n/a | yes |
78
78
| use\_ existing\_ k8s\_ sa | Use an existing kubernetes service account instead of creating one | bool | ` "false" ` | no |
Original file line number Diff line number Diff line change @@ -25,7 +25,9 @@ locals {
25
25
}
26
26
27
27
resource "google_service_account" "cluster_service_account" {
28
- account_id = var. name
28
+ # GCP service account ids must be < 30 chars matching regex ^[a-z](?:[-a-z0-9]{4,28}[a-z0-9])$
29
+ # KSA do not have this naming restriction.
30
+ account_id = substr (var. name , 0 , 30 )
29
31
display_name = substr (" GCP SA bound to K8S SA ${ local . k8s_given_name } " , 0 , 100 )
30
32
project = var. project_id
31
33
}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 15
15
*/
16
16
17
17
variable "name" {
18
- description = " Name for both service accounts"
18
+ description = " Name for both service accounts. The GCP SA will be truncated to the first 30 chars if necessary. "
19
19
type = string
20
20
}
21
21
You can’t perform that action at this time.
0 commit comments