Skip to content

Commit f026f64

Browse files
author
Aaron Lane
authored
Merge branch 'master' into master
2 parents 0bffa5c + fbc2604 commit f026f64

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+1399
-197
lines changed

.kitchen.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,23 @@ suites:
5252
systems:
5353
- name: simple_regional
5454
backend: local
55+
- name: "private_zonal_with_networking"
56+
driver:
57+
root_module_directory: test/fixtures/private_zonal_with_networking
58+
verifier:
59+
systems:
60+
- name: private_zonal_with_networking
61+
backend: local
62+
controls:
63+
- gcloud
64+
- name: private_zonal_with_networking
65+
backend: local
66+
controls:
67+
- subnet
68+
- name: network
69+
backend: gcp
70+
controls:
71+
- network
5572
- name: "simple_regional_with_networking"
5673
driver:
5774
root_module_directory: test/fixtures/simple_regional_with_networking

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ Extending the adopted spec, each change should have a link to its corresponding
1414
* Support for setting node_locations on node pools. [#303]
1515
* Fix for specifying `node_count` on node pools when autoscaling is disabled. [#311]
1616
* Added submodule for installing Anthos Config Management. [#268]
17+
* Support for `local_ssd_count` in node pool configuration. [#244]
18+
* Wait for cluster to be ready before returning endpoint. [#340]
1719

1820
## [v5.1.1] - 2019-10-25
1921

@@ -228,6 +230,7 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
228230
[v0.3.0]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v0.2.0...v0.3.0
229231
[v0.2.0]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v0.1.0...v0.2.0
230232

233+
[#340]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/340
231234
[#268]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/268
232235
[#311]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/311
233236
[#303]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/303
@@ -245,6 +248,7 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
245248
[#238]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/238
246249
[#241]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/241
247250
[#250]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/250
251+
[#244]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/244
248252
[#236]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/236
249253
[#217]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/217
250254
[#234]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/234

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# Make will use bash instead of sh
1919
SHELL := /usr/bin/env bash
2020

21-
DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 0.4.6
21+
DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 0
2222
DOCKER_IMAGE_DEVELOPER_TOOLS := cft/developer-tools
2323
REGISTRY_URL := gcr.io/cloud-foundation-cicd
2424

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ module "gke" {
4343
machine_type = "n1-standard-2"
4444
min_count = 1
4545
max_count = 100
46+
local_ssd_count = 0
4647
disk_size_gb = 100
4748
disk_type = "pd-standard"
4849
image_type = "COS"

autogen/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ module "gke" {
6060
{% endif %}
6161
min_count = 1
6262
max_count = 100
63+
local_ssd_count = 0
6364
disk_size_gb = 100
6465
disk_type = "pd-standard"
6566
image_type = "COS"
File renamed without changes.

autogen/cluster.tf renamed to autogen/cluster.tf.tmpl

Lines changed: 36 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,10 @@ resource "random_id" "name" {
252252
labels = join(",",
253253
sort(
254254
concat(
255-
keys(var.node_pools_labels["all"]),
256-
values(var.node_pools_labels["all"]),
257-
keys(var.node_pools_labels[var.node_pools[count.index]["name"]]),
258-
values(var.node_pools_labels[var.node_pools[count.index]["name"]])
255+
keys(local.node_pools_labels["all"]),
256+
values(local.node_pools_labels["all"]),
257+
keys(local.node_pools_labels[var.node_pools[count.index]["name"]]),
258+
values(local.node_pools_labels[var.node_pools[count.index]["name"]])
259259
)
260260
)
261261
)
@@ -264,10 +264,10 @@ resource "random_id" "name" {
264264
metadata = join(",",
265265
sort(
266266
concat(
267-
keys(var.node_pools_metadata["all"]),
268-
values(var.node_pools_metadata["all"]),
269-
keys(var.node_pools_metadata[var.node_pools[count.index]["name"]]),
270-
values(var.node_pools_metadata[var.node_pools[count.index]["name"]])
267+
keys(local.node_pools_metadata["all"]),
268+
values(local.node_pools_metadata["all"]),
269+
keys(local.node_pools_metadata[var.node_pools[count.index]["name"]]),
270+
values(local.node_pools_metadata[var.node_pools[count.index]["name"]])
271271
)
272272
)
273273
)
@@ -276,8 +276,8 @@ resource "random_id" "name" {
276276
oauth_scopes = join(",",
277277
sort(
278278
concat(
279-
var.node_pools_oauth_scopes["all"],
280-
var.node_pools_oauth_scopes[var.node_pools[count.index]["name"]]
279+
local.node_pools_oauth_scopes["all"],
280+
local.node_pools_oauth_scopes[var.node_pools[count.index]["name"]]
281281
)
282282
)
283283
)
@@ -286,8 +286,8 @@ resource "random_id" "name" {
286286
tags = join(",",
287287
sort(
288288
concat(
289-
var.node_pools_tags["all"],
290-
var.node_pools_tags[var.node_pools[count.index]["name"]]
289+
local.node_pools_tags["all"],
290+
local.node_pools_tags[var.node_pools[count.index]["name"]]
291291
)
292292
)
293293
)
@@ -314,7 +314,9 @@ resource "google_container_node_pool" "pools" {
314314
// use node_locations if provided, defaults to cluster level node_locations if not specified
315315
node_locations = lookup(var.node_pools[count.index], "node_locations", "") != "" ? split(",", var.node_pools[count.index]["node_locations"]) : null
316316
{% endif %}
317-
cluster = google_container_cluster.primary.name
317+
318+
cluster = google_container_cluster.primary.name
319+
318320
version = lookup(var.node_pools[count.index], "auto_upgrade", false) ? "" : lookup(
319321
var.node_pools[count.index],
320322
"version",
@@ -350,25 +352,25 @@ resource "google_container_node_pool" "pools" {
350352
image_type = lookup(var.node_pools[count.index], "image_type", "COS")
351353
machine_type = lookup(var.node_pools[count.index], "machine_type", "n1-standard-2")
352354
labels = merge(
353-
lookup(lookup(var.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {},
354-
lookup(lookup(var.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = var.node_pools[count.index]["name"] } : {},
355-
var.node_pools_labels["all"],
356-
var.node_pools_labels[var.node_pools[count.index]["name"]],
355+
lookup(lookup(local.node_pools_labels, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {},
356+
lookup(lookup(local.node_pools_labels, "default_values", {}), "node_pool", true) ? { "node_pool" = var.node_pools[count.index]["name"] } : {},
357+
local.node_pools_labels["all"],
358+
local.node_pools_labels[var.node_pools[count.index]["name"]],
357359
)
358360
metadata = merge(
359-
lookup(lookup(var.node_pools_metadata, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {},
360-
lookup(lookup(var.node_pools_metadata, "default_values", {}), "node_pool", true) ? { "node_pool" = var.node_pools[count.index]["name"] } : {},
361-
var.node_pools_metadata["all"],
362-
var.node_pools_metadata[var.node_pools[count.index]["name"]],
361+
lookup(lookup(local.node_pools_metadata, "default_values", {}), "cluster_name", true) ? { "cluster_name" = var.name } : {},
362+
lookup(lookup(local.node_pools_metadata, "default_values", {}), "node_pool", true) ? { "node_pool" = var.node_pools[count.index]["name"] } : {},
363+
local.node_pools_metadata["all"],
364+
local.node_pools_metadata[var.node_pools[count.index]["name"]],
363365
{
364366
"disable-legacy-endpoints" = var.disable_legacy_metadata_endpoints
365367
},
366368
)
367369
{% if beta_cluster %}
368370
dynamic "taint" {
369371
for_each = concat(
370-
var.node_pools_taints["all"],
371-
var.node_pools_taints[var.node_pools[count.index]["name"]],
372+
local.node_pools_taints["all"],
373+
local.node_pools_taints[var.node_pools[count.index]["name"]],
372374
)
373375
content {
374376
effect = taint.value.effect
@@ -378,14 +380,16 @@ resource "google_container_node_pool" "pools" {
378380
}
379381
{% endif %}
380382
tags = concat(
381-
lookup(var.node_pools_tags, "default_values", [true, true])[0] ? ["gke-${var.name}"] : [],
382-
lookup(var.node_pools_tags, "default_values", [true, true])[1] ? ["gke-${var.name}-${var.node_pools[count.index]["name"]}"] : [],
383-
var.node_pools_tags["all"],
384-
var.node_pools_tags[var.node_pools[count.index]["name"]],
383+
lookup(local.node_pools_tags, "default_values", [true, true])[0] ? ["gke-${var.name}"] : [],
384+
lookup(local.node_pools_tags, "default_values", [true, true])[1] ? ["gke-${var.name}-${var.node_pools[count.index]["name"]}"] : [],
385+
local.node_pools_tags["all"],
386+
local.node_pools_tags[var.node_pools[count.index]["name"]],
385387
)
386388

387-
disk_size_gb = lookup(var.node_pools[count.index], "disk_size_gb", 100)
388-
disk_type = lookup(var.node_pools[count.index], "disk_type", "pd-standard")
389+
local_ssd_count = lookup(var.node_pools[count.index], "local_ssd_count", 0)
390+
disk_size_gb = lookup(var.node_pools[count.index], "disk_size_gb", 100)
391+
disk_type = lookup(var.node_pools[count.index], "disk_type", "pd-standard")
392+
389393
service_account = lookup(
390394
var.node_pools[count.index],
391395
"service_account",
@@ -394,8 +398,8 @@ resource "google_container_node_pool" "pools" {
394398
preemptible = lookup(var.node_pools[count.index], "preemptible", false)
395399

396400
oauth_scopes = concat(
397-
var.node_pools_oauth_scopes["all"],
398-
var.node_pools_oauth_scopes[var.node_pools[count.index]["name"]],
401+
local.node_pools_oauth_scopes["all"],
402+
local.node_pools_oauth_scopes[var.node_pools[count.index]["name"]],
399403
)
400404

401405
guest_accelerator = [
@@ -429,6 +433,7 @@ resource "google_container_node_pool" "pools" {
429433

430434
lifecycle {
431435
ignore_changes = [initial_node_count]
436+
432437
{% if update_variant %}
433438
create_before_destroy = true
434439
{% endif %}
File renamed without changes.

autogen/main.tf renamed to autogen/main.tf.tmpl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@ locals {
147147
cluster_pod_security_policy_enabled = local.cluster_output_pod_security_policy_enabled
148148
cluster_intranode_visibility_enabled = local.cluster_output_intranode_visbility_enabled
149149
cluster_vertical_pod_autoscaling_enabled = local.cluster_output_vertical_pod_autoscaling_enabled
150-
cluster_workload_identity_config = var.identity_namespace == "" ? [] : [{
150+
151+
cluster_workload_identity_config = var.identity_namespace == "" ? [] : [{
151152
identity_namespace = var.identity_namespace
152153
}]
153154
# /BETA features
File renamed without changes.
File renamed without changes.

autogen/outputs.tf renamed to autogen/outputs.tf.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ output "endpoint" {
5454
*/
5555
google_container_cluster.primary,
5656
google_container_node_pool.pools,
57+
null_resource.wait_for_cluster.id,
5758
]
5859
}
5960

File renamed without changes.

autogen/variables.tf renamed to autogen/variables.tf.tmpl

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ variable "node_version" {
7979
}
8080

8181
variable "master_authorized_networks_config" {
82-
type = list(object({cidr_blocks = list(object({cidr_block = string, display_name = string}))}))
82+
type = list(object({ cidr_blocks = list(object({ cidr_block = string, display_name = string })) }))
8383
description = "The desired configuration options for master authorized networks. The object format is {cidr_blocks = list(object({cidr_block = string, display_name = string}))}. Omit the nested cidr_blocks attribute to disallow external access (except the cluster node IPs, which GKE automatically whitelists)."
8484
default = []
8585
}
@@ -163,6 +163,7 @@ variable "node_pools_labels" {
163163
type = map(map(string))
164164
description = "Map of maps containing node labels by node-pool name"
165165

166+
# Default is being set in variables_defaults.tf
166167
default = {
167168
all = {}
168169
default-node-pool = {}
@@ -173,6 +174,7 @@ variable "node_pools_metadata" {
173174
type = map(map(string))
174175
description = "Map of maps containing node metadata by node-pool name"
175176

177+
# Default is being set in variables_defaults.tf
176178
default = {
177179
all = {}
178180
default-node-pool = {}
@@ -181,9 +183,10 @@ variable "node_pools_metadata" {
181183

182184
{% if beta_cluster %}
183185
variable "node_pools_taints" {
184-
type = map(list(object({key=string,value=string,effect=string})))
186+
type = map(list(object({ key = string, value = string, effect = string })))
185187
description = "Map of lists containing node taints by node-pool name"
186188

189+
# Default is being set in variables_defaults.tf
187190
default = {
188191
all = []
189192
default-node-pool = []
@@ -195,6 +198,7 @@ variable "node_pools_tags" {
195198
type = map(list(string))
196199
description = "Map of lists containing node network tags by node-pool name"
197200

201+
# Default is being set in variables_defaults.tf
198202
default = {
199203
all = []
200204
default-node-pool = []
@@ -205,6 +209,7 @@ variable "node_pools_oauth_scopes" {
205209
type = map(list(string))
206210
description = "Map of lists containing node oauth scopes by node-pool name"
207211

212+
# Default is being set in variables_defaults.tf
208213
default = {
209214
all = ["https://www.googleapis.com/auth/cloud-platform"]
210215
default-node-pool = []
@@ -356,10 +361,11 @@ variable "default_max_pods_per_node" {
356361

357362
variable "database_encryption" {
358363
description = "Application-layer Secrets Encryption settings. The object format is {state = string, key_name = string}. Valid values of state are: \"ENCRYPTED\"; \"DECRYPTED\". key_name is the name of a CloudKMS key."
359-
type = list(object({state = string, key_name = string}))
360-
default = [{
361-
state = "DECRYPTED"
362-
key_name = ""
364+
type = list(object({ state = string, key_name = string }))
365+
366+
default = [{
367+
state = "DECRYPTED"
368+
key_name = ""
363369
}]
364370
}
365371

@@ -375,7 +381,8 @@ variable "enable_binary_authorization" {
375381

376382
variable "pod_security_policy_config" {
377383
description = "enabled - Enable the PodSecurityPolicy controller for this cluster. If enabled, pods must be valid under a PodSecurityPolicy to be created."
378-
default = [{
384+
385+
default = [{
379386
"enabled" = false
380387
}]
381388
}
@@ -429,8 +436,8 @@ variable "release_channel" {
429436
}
430437

431438
variable "enable_shielded_nodes" {
432-
type = bool
439+
type = bool
433440
description = "Enable Shielded Nodes features on all nodes in this cluster"
434-
default = false
441+
default = false
435442
}
436443
{% endif %}

autogen/variables_defaults.tf

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/**
2+
* Copyright 2019 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
{{ autogeneration_note }}
18+
19+
# Setup dynamic default values for variables which can't be setup using
20+
# the standard terraform "variable default" functionality
21+
22+
locals {
23+
node_pools_labels = merge(
24+
{ all = {} },
25+
{ default-node-pool = {} },
26+
zipmap(
27+
[for node_pool in var.node_pools : node_pool["name"]],
28+
[for node_pool in var.node_pools : {}]
29+
),
30+
var.node_pools_labels
31+
)
32+
33+
node_pools_metadata = merge(
34+
{ all = {} },
35+
{ default-node-pool = {} },
36+
zipmap(
37+
[for node_pool in var.node_pools : node_pool["name"]],
38+
[for node_pool in var.node_pools : {}]
39+
),
40+
var.node_pools_metadata
41+
)
42+
43+
{% if beta_cluster %}
44+
node_pools_taints = merge(
45+
{ all = [] },
46+
{ default-node-pool = [] },
47+
zipmap(
48+
[for node_pool in var.node_pools : node_pool["name"]],
49+
[for node_pool in var.node_pools : []]
50+
),
51+
var.node_pools_taints
52+
)
53+
54+
{% endif %}
55+
node_pools_tags = merge(
56+
{ all = [] },
57+
{ default-node-pool = [] },
58+
zipmap(
59+
[for node_pool in var.node_pools : node_pool["name"]],
60+
[for node_pool in var.node_pools : []]
61+
),
62+
var.node_pools_tags
63+
)
64+
65+
node_pools_oauth_scopes = merge(
66+
{ all = ["https://www.googleapis.com/auth/cloud-platform"] },
67+
{ default-node-pool = [] },
68+
zipmap(
69+
[for node_pool in var.node_pools : node_pool["name"]],
70+
[for node_pool in var.node_pools : []]
71+
),
72+
var.node_pools_oauth_scopes
73+
)
74+
}
File renamed without changes.

0 commit comments

Comments
 (0)