Skip to content

Commit

Permalink
Merge branch 'master' into internal/remove-credentials-path
Browse files Browse the repository at this point in the history
  • Loading branch information
aaron-lane committed Mar 13, 2019
2 parents eca6d0e + de467d9 commit c2a8dc4
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 12 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 cluster_zonal.tf
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ resource "google_container_node_pool" "zonal_pools" {

management {
auto_repair = "${lookup(var.node_pools[count.index], "auto_repair", true)}"
auto_upgrade = "${lookup(var.node_pools[count.index], "auto_upgrade", false)}"
auto_upgrade = "${lookup(var.node_pools[count.index], "auto_upgrade", true)}"
}

node_config {
Expand Down
2 changes: 2 additions & 0 deletions examples/deploy_service/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ module "gke" {
network = "${var.network}"
subnetwork = "${var.subnetwork}"

kubernetes_version = "1.11.7-gke.12"

ip_range_pods = "${var.ip_range_pods}"
ip_range_services = "${var.ip_range_services}"
service_account = "${var.compute_engine_service_account}"
Expand Down
20 changes: 12 additions & 8 deletions examples/node_pool/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,23 @@ provider "google" {
}

module "gke" {
source = "../../"
project_id = "${var.project_id}"
name = "${local.cluster_type}-cluster${var.cluster_name_suffix}"
region = "${var.region}"
network = "${var.network}"
subnetwork = "${var.subnetwork}"
ip_range_pods = "${var.ip_range_pods}"
ip_range_services = "${var.ip_range_services}"
source = "../../"
project_id = "${var.project_id}"
name = "${local.cluster_type}-cluster${var.cluster_name_suffix}"
regional = "false"
region = "${var.region}"
zones = "${var.zones}"
network = "${var.network}"
subnetwork = "${var.subnetwork}"
ip_range_pods = "${var.ip_range_pods}"
ip_range_services = "${var.ip_range_services}"
remove_default_node_pool = "true"

node_pools = [
{
name = "pool-01"
min_count = 1
max_count = 2
service_account = "${var.compute_engine_service_account}"
},
{
Expand Down
5 changes: 5 additions & 0 deletions examples/node_pool/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ variable "region" {
description = "The region to host the cluster in"
}

variable "zones" {
type = "list"
description = "The zone to host the cluster in (required if is a zonal cluster)"
}

variable "network" {
description = "The VPC network to host the cluster in"
}
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
1 change: 1 addition & 0 deletions test/fixtures/node_pool/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module "example" {
project_id = "${var.project_id}"
cluster_name_suffix = "-${random_string.suffix.result}"
region = "${var.region}"
zones = ["${slice(var.zones,0,1)}"]
network = "${google_compute_network.main.name}"
subnetwork = "${google_compute_subnetwork.main.name}"
ip_range_pods = "${google_compute_subnetwork.main.secondary_ip_range.0.range_name}"
Expand Down

0 comments on commit c2a8dc4

Please sign in to comment.