Skip to content

Commit

Permalink
Merge pull request terraform-google-modules#91 from basisai/fix-substr
Browse files Browse the repository at this point in the history
Fix issues with `substr` for Service Accounts
  • Loading branch information
adrienthebo authored Mar 12, 2019
2 parents daea924 + 2ed068f commit de467d9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion autogen/sa.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ locals {
resource "google_service_account" "cluster_service_account" {
count = "${var.service_account == "create" ? 1 : 0}"
project = "${var.project_id}"
account_id = "tf-gke-${substr(var.name, 0, 20)}"
account_id = "tf-gke-${substr(var.name, 0, min(20, length(var.name)))}"
display_name = "Terraform-managed service account for cluster ${var.name}"
}

Expand Down
2 changes: 1 addition & 1 deletion modules/private-cluster/sa.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ locals {
resource "google_service_account" "cluster_service_account" {
count = "${var.service_account == "create" ? 1 : 0}"
project = "${var.project_id}"
account_id = "tf-gke-${substr(var.name, 0, 20)}"
account_id = "tf-gke-${substr(var.name, 0, min(20, length(var.name)))}"
display_name = "Terraform-managed service account for cluster ${var.name}"
}

Expand Down
2 changes: 1 addition & 1 deletion sa.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ locals {
resource "google_service_account" "cluster_service_account" {
count = "${var.service_account == "create" ? 1 : 0}"
project = "${var.project_id}"
account_id = "tf-gke-${substr(var.name, 0, 20)}"
account_id = "tf-gke-${substr(var.name, 0, min(20, length(var.name)))}"
display_name = "Terraform-managed service account for cluster ${var.name}"
}

Expand Down

0 comments on commit de467d9

Please sign in to comment.