Skip to content

Commit 00532b2

Browse files
authored
Merge pull request #132 from marko7460/fix/empty-zone-list
Fix/empty zone list
2 parents aaa48de + e101f7b commit 00532b2

File tree

12 files changed

+30
-29
lines changed

12 files changed

+30
-29
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
Extending the adopted spec, each change should have a link to its corresponding pull request appended.
88

99
## [Unreleased]
10+
### Fixed
11+
* Fix empty zone list. [#132]
1012

1113
## [v1.0.0] - 2019-03-25
1214
### Added
@@ -72,6 +74,7 @@ Extending the adopted spec, each change should have a link to its corresponding
7274
[#42]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/42
7375
[#15]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/15
7476

77+
[#132]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/132
7578
[#109]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/109
7679
[#108]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/108
7780
[#106]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/106

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ SHELL := /usr/bin/env bash
1818
# Docker build config variables
1919
CREDENTIALS_PATH ?= /cft/workdir/credentials.json
2020
DOCKER_ORG := gcr.io/cloud-foundation-cicd
21-
DOCKER_TAG_BASE_KITCHEN_TERRAFORM ?= 0.11.10_216.0.0_1.19.1_0.1.10
21+
DOCKER_TAG_BASE_KITCHEN_TERRAFORM ?= 1.0.0
2222
DOCKER_REPO_BASE_KITCHEN_TERRAFORM := ${DOCKER_ORG}/cft/kitchen-terraform:${DOCKER_TAG_BASE_KITCHEN_TERRAFORM}
2323
DOCKER_TAG_KITCHEN_TERRAFORM ?= ${DOCKER_TAG_BASE_KITCHEN_TERRAFORM}
24-
DOCKER_IMAGE_KITCHEN_TERRAFORM := cft/kitchen-terraform_terraform-google-kubernetes-engine
24+
DOCKER_IMAGE_KITCHEN_TERRAFORM := ${DOCKER_ORG}/cft/kitchen-terraform_terraform-google-kubernetes-engine
2525

2626
# All is the first target in the file so it will get picked up when you just run 'make' on its own
2727
.PHONY: all

autogen/cluster_regional.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ resource "google_container_cluster" "primary" {
2727
project = "${var.project_id}"
2828

2929
region = "${var.region}"
30-
additional_zones = ["${coalescelist(compact(var.zones), sort(random_shuffle.available_zones.result))}"]
30+
node_locations = ["${coalescelist(compact(var.zones), sort(random_shuffle.available_zones.result))}"]
3131

3232
network = "${replace(data.google_compute_network.gke_network.self_link, "https://www.googleapis.com/compute/v1/", "")}"
3333
subnetwork = "${replace(data.google_compute_subnetwork.gke_subnetwork.self_link, "https://www.googleapis.com/compute/v1/", "")}"

autogen/cluster_zonal.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ resource "google_container_cluster" "zonal_primary" {
2727
project = "${var.project_id}"
2828

2929
zone = "${var.zones[0]}"
30-
additional_zones = ["${slice(var.zones,1,length(var.zones))}"]
30+
node_locations = ["${slice(var.zones,1,length(var.zones))}"]
3131

3232
network = "${replace(data.google_compute_network.gke_network.self_link, "https://www.googleapis.com/compute/v1/", "")}"
3333
subnetwork = "${replace(data.google_compute_subnetwork.gke_subnetwork.self_link, "https://www.googleapis.com/compute/v1/", "")}"

autogen/main.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ locals {
5555
zonal = "${var.region}"
5656
}
5757

58-
cluster_type_output_regional_zones = "${concat(google_container_cluster.primary.*.additional_zones, list(list()))}"
59-
cluster_type_output_zonal_zones = "${concat(slice(var.zones,1,length(var.zones)), list(list()))}"
58+
cluster_type_output_regional_zones = "${flatten(google_container_cluster.primary.*.node_locations)}"
59+
cluster_type_output_zonal_zones = "${slice(var.zones, 1, length(var.zones))}"
6060

6161
cluster_type_output_zones = {
62-
regional = "${local.cluster_type_output_regional_zones[0]}"
63-
zonal = "${concat(google_container_cluster.zonal_primary.*.zone, local.cluster_type_output_zonal_zones[0])}"
62+
regional = "${local.cluster_type_output_regional_zones}"
63+
zonal = "${concat(google_container_cluster.zonal_primary.*.zone, local.cluster_type_output_zonal_zones)}"
6464
}
6565

6666
cluster_type_output_endpoint = {

build/docker/kitchen_terraform/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ ARG BASE_IMAGE
1818
FROM $BASE_IMAGE
1919

2020
RUN apk add --no-cache \
21-
ca-certificates=20171114-r3
21+
ca-certificates=20190108-r0
2222

2323
ADD https://storage.googleapis.com/kubernetes-release/release/v1.12.2/bin/linux/amd64/kubectl /usr/local/bin/kubectl
2424
RUN chmod +x /usr/local/bin/kubectl

cluster_regional.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ resource "google_container_cluster" "primary" {
2727
project = "${var.project_id}"
2828

2929
region = "${var.region}"
30-
additional_zones = ["${coalescelist(compact(var.zones), sort(random_shuffle.available_zones.result))}"]
30+
node_locations = ["${coalescelist(compact(var.zones), sort(random_shuffle.available_zones.result))}"]
3131

3232
network = "${replace(data.google_compute_network.gke_network.self_link, "https://www.googleapis.com/compute/v1/", "")}"
3333
subnetwork = "${replace(data.google_compute_subnetwork.gke_subnetwork.self_link, "https://www.googleapis.com/compute/v1/", "")}"

cluster_zonal.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ resource "google_container_cluster" "zonal_primary" {
2727
project = "${var.project_id}"
2828

2929
zone = "${var.zones[0]}"
30-
additional_zones = ["${slice(var.zones,1,length(var.zones))}"]
30+
node_locations = ["${slice(var.zones,1,length(var.zones))}"]
3131

3232
network = "${replace(data.google_compute_network.gke_network.self_link, "https://www.googleapis.com/compute/v1/", "")}"
3333
subnetwork = "${replace(data.google_compute_subnetwork.gke_subnetwork.self_link, "https://www.googleapis.com/compute/v1/", "")}"

main.tf

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ locals {
5555
zonal = "${var.region}"
5656
}
5757

58-
cluster_type_output_regional_zones = "${concat(google_container_cluster.primary.*.additional_zones, list(list()))}"
59-
cluster_type_output_zonal_zones = "${concat(slice(var.zones,1,length(var.zones)), list(list()))}"
58+
cluster_type_output_regional_zones = "${flatten(google_container_cluster.primary.*.node_locations)}"
59+
cluster_type_output_zonal_zones = "${slice(var.zones, 1, length(var.zones))}"
6060

6161
cluster_type_output_zones = {
62-
regional = "${local.cluster_type_output_regional_zones[0]}"
63-
zonal = "${concat(google_container_cluster.zonal_primary.*.zone, local.cluster_type_output_zonal_zones[0])}"
62+
regional = "${local.cluster_type_output_regional_zones}"
63+
zonal = "${concat(google_container_cluster.zonal_primary.*.zone, local.cluster_type_output_zonal_zones)}"
6464
}
6565

6666
cluster_type_output_endpoint = {
@@ -161,7 +161,6 @@ data "google_container_engine_versions" "zone" {
161161
//
162162
// data.google_container_engine_versions.zone: Cannot determine zone: set in this resource, or set provider-level zone.
163163
//
164-
zone = "${var.zones[0] == "" ? data.google_compute_zones.available.names[0] : var.zones[0]}"
165-
166-
project = "${var.project_id}"
167-
}
164+
zone = "${var.zones[0] == "" ? data.google_compute_zones.available.names[0] : var.zones[0]}"
165+
project = "${var.project_id}"
166+
}

modules/private-cluster/cluster_regional.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ resource "google_container_cluster" "primary" {
2727
project = "${var.project_id}"
2828

2929
region = "${var.region}"
30-
additional_zones = ["${coalescelist(compact(var.zones), sort(random_shuffle.available_zones.result))}"]
30+
node_locations = ["${coalescelist(compact(var.zones), sort(random_shuffle.available_zones.result))}"]
3131

3232
network = "${replace(data.google_compute_network.gke_network.self_link, "https://www.googleapis.com/compute/v1/", "")}"
3333
subnetwork = "${replace(data.google_compute_subnetwork.gke_subnetwork.self_link, "https://www.googleapis.com/compute/v1/", "")}"

0 commit comments

Comments
 (0)