From 2833cb48a322ba560639745c411a8b15518e715e Mon Sep 17 00:00:00 2001 From: cloud-foundation-bot <60107303+cloud-foundation-bot@users.noreply.github.com> Date: Sun, 14 Nov 2021 21:10:43 -0600 Subject: [PATCH 1/4] chore: update tests to use 1.0 image and update compat note (#62) * chore: update tests to use 1.0 image and update compat note * fix op Co-authored-by: Bharath KKB <bharathkrishnakb@gmail.com> --- .github/release-please.yml | 14 ++++++++++++++ .github/workflows/stale.yml | 14 ++++++++++++++ .gitignore | 3 +++ Makefile | 2 +- build/int.cloudbuild.yaml | 2 +- build/lint.cloudbuild.yaml | 2 +- main.tf | 2 +- test/fixtures/vpn_ha/outputs.tf | 2 ++ test/integration/single_tunnels/inspec.yml | 14 ++++++++++++++ test/integration/vpn_ha/inspec.yml | 14 ++++++++++++++ tunnel.tf | 2 +- 11 files changed, 66 insertions(+), 5 deletions(-) diff --git a/.github/release-please.yml b/.github/release-please.yml index 6366b9c..884357c 100644 --- a/.github/release-please.yml +++ b/.github/release-please.yml @@ -1,2 +1,16 @@ +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + releaseType: terraform-module handleGHRelease: true diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index fcf18fe..de1fd4a 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -1,3 +1,17 @@ +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + name: "Close stale issues" on: schedule: diff --git a/.gitignore b/.gitignore index 477cdaf..1faffbd 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,6 @@ crash.log test/fixtures/shared/terraform.tfvars credentials.json + +# tf lock file +.terraform.lock.hcl diff --git a/Makefile b/Makefile index a489ae1..1aef813 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ # Make will use bash instead of sh SHELL := /usr/bin/env bash -DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 0.13 +DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 1.0 DOCKER_IMAGE_DEVELOPER_TOOLS := cft/developer-tools REGISTRY_URL := gcr.io/cloud-foundation-cicd diff --git a/build/int.cloudbuild.yaml b/build/int.cloudbuild.yaml index 1ff758e..97a0c8b 100644 --- a/build/int.cloudbuild.yaml +++ b/build/int.cloudbuild.yaml @@ -38,4 +38,4 @@ tags: - 'integration' substitutions: _DOCKER_IMAGE_DEVELOPER_TOOLS: 'cft/developer-tools' - _DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '0.13' + _DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '1.0' diff --git a/build/lint.cloudbuild.yaml b/build/lint.cloudbuild.yaml index 7c1aecb..34d006d 100644 --- a/build/lint.cloudbuild.yaml +++ b/build/lint.cloudbuild.yaml @@ -21,4 +21,4 @@ tags: - 'lint' substitutions: _DOCKER_IMAGE_DEVELOPER_TOOLS: 'cft/developer-tools' - _DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '0.13' + _DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '1.0' diff --git a/main.tf b/main.tf index 36b5b79..33dde3c 100644 --- a/main.tf +++ b/main.tf @@ -22,7 +22,7 @@ locals { # For VPN gateways with static routing ## Create Route (for static routing gateways) resource "google_compute_route" "route" { - count = ! var.cr_enabled ? var.tunnel_count * length(var.remote_subnet) : 0 + count = !var.cr_enabled ? var.tunnel_count * length(var.remote_subnet) : 0 name = "${google_compute_vpn_gateway.vpn_gateway.name}-tunnel${floor(count.index / length(var.remote_subnet)) + 1}-route${count.index % length(var.remote_subnet) + 1}" network = var.network project = var.project_id diff --git a/test/fixtures/vpn_ha/outputs.tf b/test/fixtures/vpn_ha/outputs.tf index 3977d8b..f21b13f 100644 --- a/test/fixtures/vpn_ha/outputs.tf +++ b/test/fixtures/vpn_ha/outputs.tf @@ -35,11 +35,13 @@ output "prod_gateway_name" { output "prod_tunnel_names" { description = "Prod VPN tunnel names." value = module.vpn_ha.prod_tunnel_names + sensitive = true } output "mgt_tunnel_names" { description = "Mgt VPN tunnel names." value = module.vpn_ha.mgt_tunnel_names + sensitive = true } output "region" { diff --git a/test/integration/single_tunnels/inspec.yml b/test/integration/single_tunnels/inspec.yml index 2256aee..19f3400 100644 --- a/test/integration/single_tunnels/inspec.yml +++ b/test/integration/single_tunnels/inspec.yml @@ -1,3 +1,17 @@ +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + name: single_tunnels depends: - name: inspec-gcp diff --git a/test/integration/vpn_ha/inspec.yml b/test/integration/vpn_ha/inspec.yml index 11806ea..46782ac 100644 --- a/test/integration/vpn_ha/inspec.yml +++ b/test/integration/vpn_ha/inspec.yml @@ -1,3 +1,17 @@ +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + name: vpn_ha attributes: - name: mgt_project_id diff --git a/tunnel.tf b/tunnel.tf index 76bc13e..075e3bf 100644 --- a/tunnel.tf +++ b/tunnel.tf @@ -20,7 +20,7 @@ resource "random_id" "ipsec_secret" { } resource "google_compute_vpn_tunnel" "tunnel-static" { - count = ! var.cr_enabled ? var.tunnel_count : 0 + count = !var.cr_enabled ? var.tunnel_count : 0 name = var.tunnel_count == 1 ? format("%s-%s", local.tunnel_name_prefix, "1") : format("%s-%d", local.tunnel_name_prefix, count.index + 1) region = var.region project = var.project_id From a9bd3a70635e0229119618c8872e200369b8d6e2 Mon Sep 17 00:00:00 2001 From: cloud-foundation-bot <60107303+cloud-foundation-bot@users.noreply.github.com> Date: Mon, 17 Jan 2022 15:20:25 -0600 Subject: [PATCH 2/4] feat: update TPG version constraints to allow 4.0 (#66) --- examples/multi_tunnels/versions.tf | 10 ++++++++-- examples/single_tunnels/versions.tf | 10 ++++++++-- modules/vpn_ha/versions.tf | 4 ++-- versions.tf | 2 +- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/examples/multi_tunnels/versions.tf b/examples/multi_tunnels/versions.tf index 832ec1d..37a1c11 100644 --- a/examples/multi_tunnels/versions.tf +++ b/examples/multi_tunnels/versions.tf @@ -1,5 +1,5 @@ /** - * Copyright 2018 Google LLC + * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,5 +15,11 @@ */ terraform { - required_version = ">= 0.12" + required_providers { + google = { + source = "hashicorp/google" + version = "~> 4.0" + } + } + required_version = ">= 0.13" } diff --git a/examples/single_tunnels/versions.tf b/examples/single_tunnels/versions.tf index 832ec1d..37a1c11 100644 --- a/examples/single_tunnels/versions.tf +++ b/examples/single_tunnels/versions.tf @@ -1,5 +1,5 @@ /** - * Copyright 2018 Google LLC + * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,5 +15,11 @@ */ terraform { - required_version = ">= 0.12" + required_providers { + google = { + source = "hashicorp/google" + version = "~> 4.0" + } + } + required_version = ">= 0.13" } diff --git a/modules/vpn_ha/versions.tf b/modules/vpn_ha/versions.tf index dd3786b..292049b 100644 --- a/modules/vpn_ha/versions.tf +++ b/modules/vpn_ha/versions.tf @@ -19,11 +19,11 @@ terraform { required_providers { google = { source = "hashicorp/google" - version = ">= 3.30.0" + version = ">= 3.30.0, < 5.0" } google-beta = { source = "hashicorp/google-beta" - version = ">= 3.30.0" + version = ">= 3.30.0, < 5.0" } } diff --git a/versions.tf b/versions.tf index 966af5c..3cbf163 100644 --- a/versions.tf +++ b/versions.tf @@ -19,7 +19,7 @@ terraform { required_providers { google = { source = "hashicorp/google" - version = ">= 3.30.0" + version = ">= 3.30.0, < 5.0" } } From 50120ec35c0961d6cb79b2e640a7d154ebc341c5 Mon Sep 17 00:00:00 2001 From: davi5e <davi87@protonmail.com> Date: Tue, 18 Jan 2022 15:23:46 -0300 Subject: [PATCH 3/4] fix: for_each can not receive null vpn_ha (#67) Simple syntax correction so Terraform can run smoothly. Co-authored-by: Bharath KKB <bharathkrishnakb@gmail.com> --- modules/vpn_ha/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/vpn_ha/main.tf b/modules/vpn_ha/main.tf index afa7cfe..1563108 100644 --- a/modules/vpn_ha/main.tf +++ b/modules/vpn_ha/main.tf @@ -84,7 +84,7 @@ resource "google_compute_router" "router" { for_each = ( var.router_advertise_config == null ? {} : ( var.router_advertise_config.mode != "CUSTOM" - ? null + ? {} : var.router_advertise_config.ip_ranges ) ) From 32930b386bf49b4dd23b7b3d494584adbfb2678e Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 27 Jan 2022 13:37:44 -0600 Subject: [PATCH 4/4] chore(master): release 2.2.0 (#68) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- CHANGELOG.md | 12 ++++++++++++ modules/vpn_ha/versions.tf | 4 ++-- versions.tf | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ef16c1f..4b8dbc3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,18 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.2.0](https://github.com/terraform-google-modules/terraform-google-vpn/compare/v2.1.0...v2.2.0) (2022-01-18) + + +### Features + +* update TPG version constraints to allow 4.0 ([#66](https://github.com/terraform-google-modules/terraform-google-vpn/issues/66)) ([a9bd3a7](https://github.com/terraform-google-modules/terraform-google-vpn/commit/a9bd3a70635e0229119618c8872e200369b8d6e2)) + + +### Bug Fixes + +* for_each can not receive null vpn_ha ([#67](https://github.com/terraform-google-modules/terraform-google-vpn/issues/67)) ([50120ec](https://github.com/terraform-google-modules/terraform-google-vpn/commit/50120ec35c0961d6cb79b2e640a7d154ebc341c5)) + ## [2.1.0](https://www.github.com/terraform-google-modules/terraform-google-vpn/compare/v2.0.0...v2.1.0) (2021-09-23) diff --git a/modules/vpn_ha/versions.tf b/modules/vpn_ha/versions.tf index 292049b..c797444 100644 --- a/modules/vpn_ha/versions.tf +++ b/modules/vpn_ha/versions.tf @@ -28,9 +28,9 @@ terraform { } provider_meta "google" { - module_name = "blueprints/terraform/terraform-google-vpn/v2.1.0" + module_name = "blueprints/terraform/terraform-google-vpn/v2.2.0" } provider_meta "google-beta" { - module_name = "blueprints/terraform/terraform-google-vpn/v2.1.0" + module_name = "blueprints/terraform/terraform-google-vpn/v2.2.0" } } diff --git a/versions.tf b/versions.tf index 3cbf163..05b344c 100644 --- a/versions.tf +++ b/versions.tf @@ -24,6 +24,6 @@ terraform { } provider_meta "google" { - module_name = "blueprints/terraform/terraform-google-vpn/v2.1.0" + module_name = "blueprints/terraform/terraform-google-vpn/v2.2.0" } }