Skip to content
This repository was archived by the owner on Jan 13, 2024. It is now read-only.

Commit 32db990

Browse files
authored
feat: Add Terraform 0.13 constraint and module attribution (terraform-google-modules#792)
BREAKING CHANGE: Minimum Terraform core version increased to 0.13.
1 parent 4e4ce02 commit 32db990

File tree

31 files changed

+308
-52
lines changed

31 files changed

+308
-52
lines changed

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.12.2
21+
DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 0.13
2222
DOCKER_IMAGE_DEVELOPER_TOOLS := cft/developer-tools
2323
REGISTRY_URL := gcr.io/cloud-foundation-cicd
2424

autogen/main/cluster.tf.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,10 +567,10 @@ resource "google_container_node_pool" "pools" {
567567
}
568568

569569
dynamic "linux_node_config" {
570-
for_each = merge(
570+
for_each = length(merge(
571571
local.node_pools_linux_node_configs_sysctls["all"],
572572
local.node_pools_linux_node_configs_sysctls[each.value["name"]]
573-
) != {} ? [1] : []
573+
)) != 0 ? [1] : []
574574

575575
content {
576576
sysctls = merge(

autogen/main/versions.tf.tmpl

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,39 @@
1414
* limitations under the License.
1515
*/
1616

17+
{% set module_path_str = module_path|string %}
18+
{% set module_registry_name = module_path_str.split('/')[-1] %}
19+
1720
terraform {
18-
required_version = ">=0.12.6"
21+
required_version = ">=0.13"
1922

20-
required_providers {
2123
{% if beta_cluster %}
22-
google-beta = ">= 3.49.0, <4.0.0"
23-
kubernetes = "~> 1.10, != 1.11.0"
24+
required_providers {
25+
google-beta = {
26+
source = "hashicorp/google-beta"
27+
version = ">= 3.49.0, <4.0.0"
28+
}
29+
kubernetes = {
30+
source = "hashicorp/kubernetes"
31+
version = "~> 1.10, != 1.11.0"
32+
}
33+
}
34+
provider_meta "google-beta" {
35+
module_name = "blueprints/terraform/terraform-google-kubernetes-engine{% if module_registry_name %}:{{ module_registry_name }}{% endif %}/v13.0.0"
36+
}
2437
{% else %}
25-
google = ">= 3.39.0, <4.0.0"
26-
kubernetes = "~> 1.10, != 1.11.0"
27-
{% endif %}
38+
required_providers {
39+
google = {
40+
source = "hashicorp/google"
41+
version = ">= 3.39.0, <4.0.0"
42+
}
43+
kubernetes = {
44+
source = "hashicorp/kubernetes"
45+
version = "~> 1.10, != 1.11.0"
46+
}
2847
}
48+
provider_meta "google" {
49+
module_name = "blueprints/terraform/terraform-google-kubernetes-engine{% if module_registry_name %}:{{ module_registry_name }}{% endif %}/v13.0.0"
50+
}
51+
{% endif %}
2952
}

autogen/safer-cluster/versions.tf.tmpl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@
1616

1717
{{ autogeneration_note }}
1818

19+
{% set module_path_str = module_path|string %}
20+
{% set module_registry_name = module_path_str.split('/')[-1] %}
21+
1922
terraform {
20-
required_version = ">=0.12"
23+
required_version = ">=0.13"
24+
25+
provider_meta "google-beta" {
26+
module_name = "blueprints/terraform/terraform-google-kubernetes-engine{% if module_registry_name %}:{{ module_registry_name }}{% endif %}/v13.0.0"
27+
}
2128
}

build/int.cloudbuild.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,6 @@ tags:
429429
- 'integration'
430430
substitutions:
431431
_DOCKER_IMAGE_DEVELOPER_TOOLS: 'cft/developer-tools'
432-
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '0.12.2'
432+
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '0.13'
433433
options:
434434
machineType: 'N1_HIGHCPU_8'

build/lint.cloudbuild.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ tags:
2222
- 'lint'
2323
substitutions:
2424
_DOCKER_IMAGE_DEVELOPER_TOOLS: 'cft/developer-tools'
25-
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '0.12.2'
25+
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '0.13'
2626
options:
2727
machineType: 'N1_HIGHCPU_8'
2828
env:

examples/safer_cluster/main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ locals {
2727
master_auth_subnetwork = "safer-cluster-master-subnet"
2828
pods_range_name = "ip-range-pods-${random_string.suffix.result}"
2929
svc_range_name = "ip-range-svc-${random_string.suffix.result}"
30+
subnet_names = [for subnet_self_link in module.gcp-network.subnets_self_links : split("/", subnet_self_link)[length(split("/", subnet_self_link)) - 1]]
3031
}
3132

3233
provider "google" {
@@ -53,7 +54,7 @@ module "gke" {
5354
regional = true
5455
region = var.region
5556
network = module.gcp-network.network_name
56-
subnetwork = module.gcp-network.subnets_names[index(module.gcp-network.subnets_names, local.subnet_name)]
57+
subnetwork = local.subnet_names[index(module.gcp-network.subnets_names, local.subnet_name)]
5758
ip_range_pods = local.pods_range_name
5859
ip_range_services = local.svc_range_name
5960
compute_engine_service_account = var.compute_engine_service_account

examples/safer_cluster_iap_bastion/apis.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
module "enabled_google_apis" {
1818
source = "terraform-google-modules/project-factory/google//modules/project_services"
19-
version = "~> 8.0"
19+
version = "~> 10.0"
2020

2121
project_id = var.project_id
2222
disable_services_on_destroy = false

examples/safer_cluster_iap_bastion/provider.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
provider "google" {
18-
version = "~> 3.42.0"
18+
version = "~> 3.50.0"
1919
}
2020

2121
provider "google-beta" {

modules/asm/versions.tf

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
/**
3+
* Copyright 2021 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
terraform {
19+
required_version = ">= 0.13.0"
20+
21+
provider_meta "google" {
22+
module_name = "blueprints/terraform/terraform-google-kubernetes-engine:asm/v13.0.0"
23+
}
24+
}

0 commit comments

Comments
 (0)