From 7ceff0f8368a188258fbdd3153b1669f31b7ca37 Mon Sep 17 00:00:00 2001 From: Morgante Pell Date: Thu, 25 Mar 2021 10:12:58 -0400 Subject: [PATCH] fix: Upgrade project_services submodule to support 0.14. (#48) * Regenerate docs * Fix lints * verify_version: false * driver * remove legacy make_source --- .kitchen.yml | 5 ++++ Makefile | 2 +- README.md | 34 +++++++++++++------------- build/int.cloudbuild.yaml | 2 +- build/lint.cloudbuild.yaml | 2 +- examples/basic/memorystore.tf | 1 - examples/memcache/main.tf | 3 +-- main.tf | 2 +- modules/memcache/README.md | 28 ++++++++++----------- modules/memcache/main.tf | 2 +- test/fixtures/memcache/README.md | 18 +++++++------- test/fixtures/memcache/main.tf | 4 --- test/fixtures/minimal/README.md | 32 ++++++++++++------------ test/fixtures/redis/README.md | 42 ++++++++++++++++---------------- test/setup/main.tf | 2 +- test/setup/make_source.sh | 28 --------------------- test/setup/versions.tf | 8 ------ 17 files changed, 89 insertions(+), 126 deletions(-) delete mode 100755 test/setup/make_source.sh diff --git a/.kitchen.yml b/.kitchen.yml index c4052ad8..4a83401e 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -16,6 +16,11 @@ provisioner: name: "terraform" +driver: + name: "terraform" + command_timeout: 1800 + verify_version: false + platforms: - name: local diff --git a/Makefile b/Makefile index d9b0bbbe..b41a9839 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.11.6 +DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 0.14 DOCKER_IMAGE_DEVELOPER_TOOLS := cft/developer-tools REGISTRY_URL := gcr.io/cloud-foundation-cicd diff --git a/README.md b/README.md index 20dc5ae6..e3831f6c 100644 --- a/README.md +++ b/README.md @@ -24,23 +24,23 @@ module "memorystore" { ## Inputs | Name | Description | Type | Default | Required | -|------|-------------|:----:|:-----:|:-----:| -| alternative\_location\_id | The alternative zone where the instance will be provisioned. | string | `"null"` | no | -| auth\_enabled | Indicates whether OSS Redis AUTH is enabled for the instance. If set to true AUTH is enabled on the instance. | bool | `"false"` | no | -| authorized\_network | The full name of the Google Compute Engine network to which the instance is connected. If left unspecified, the default network will be used. | string | `"null"` | no | -| connect\_mode | The connection mode of the Redis instance. Can be either DIRECT_PEERING or PRIVATE_SERVICE_ACCESS. The default connect mode if not provided is DIRECT_PEERING. | string | `"null"` | no | -| display\_name | An arbitrary and optional user-provided name for the instance. | string | `"null"` | no | -| enable\_apis | Flag for enabling redis.googleapis.com in your project | bool | `"true"` | no | -| labels | The resource labels to represent user provided metadata. | map(string) | `"null"` | no | -| location\_id | The zone where the instance will be provisioned. If not provided, the service will choose a zone for the instance. For STANDARD_HA tier, instances will be created across two zones for protection against zonal failures. If [alternativeLocationId] is also provided, it must be different from [locationId]. | string | `"null"` | no | -| memory\_size\_gb | Redis memory size in GiB. Defaulted to 1 GiB | number | `"1"` | no | -| name | The ID of the instance or a fully qualified identifier for the instance. | string | n/a | yes | -| project | The ID of the project in which the resource belongs to. | string | n/a | yes | -| redis\_configs | The Redis configuration parameters. See [more details](https://cloud.google.com/memorystore/docs/redis/reference/rest/v1/projects.locations.instances#Instance.FIELDS.redis_configs) | map(any) | `` | no | -| redis\_version | The version of Redis software. | string | `"null"` | no | -| region | The GCP region to use. | string | `"null"` | no | -| reserved\_ip\_range | The CIDR range of internal addresses that are reserved for this instance. | string | `"null"` | no | -| tier | The service tier of the instance. https://cloud.google.com/memorystore/docs/redis/reference/rest/v1/projects.locations.instances#Tier | string | `"STANDARD_HA"` | no | +|------|-------------|------|---------|:--------:| +| alternative\_location\_id | The alternative zone where the instance will be provisioned. | `string` | `null` | no | +| auth\_enabled | Indicates whether OSS Redis AUTH is enabled for the instance. If set to true AUTH is enabled on the instance. | `bool` | `false` | no | +| authorized\_network | The full name of the Google Compute Engine network to which the instance is connected. If left unspecified, the default network will be used. | `string` | `null` | no | +| connect\_mode | The connection mode of the Redis instance. Can be either DIRECT\_PEERING or PRIVATE\_SERVICE\_ACCESS. The default connect mode if not provided is DIRECT\_PEERING. | `string` | `null` | no | +| display\_name | An arbitrary and optional user-provided name for the instance. | `string` | `null` | no | +| enable\_apis | Flag for enabling redis.googleapis.com in your project | `bool` | `true` | no | +| labels | The resource labels to represent user provided metadata. | `map(string)` | `null` | no | +| location\_id | The zone where the instance will be provisioned. If not provided, the service will choose a zone for the instance. For STANDARD\_HA tier, instances will be created across two zones for protection against zonal failures. If [alternativeLocationId] is also provided, it must be different from [locationId]. | `string` | `null` | no | +| memory\_size\_gb | Redis memory size in GiB. Defaulted to 1 GiB | `number` | `1` | no | +| name | The ID of the instance or a fully qualified identifier for the instance. | `string` | n/a | yes | +| project | The ID of the project in which the resource belongs to. | `string` | n/a | yes | +| redis\_configs | The Redis configuration parameters. See [more details](https://cloud.google.com/memorystore/docs/redis/reference/rest/v1/projects.locations.instances#Instance.FIELDS.redis_configs) | `map(any)` | `{}` | no | +| redis\_version | The version of Redis software. | `string` | `null` | no | +| region | The GCP region to use. | `string` | `null` | no | +| reserved\_ip\_range | The CIDR range of internal addresses that are reserved for this instance. | `string` | `null` | no | +| tier | The service tier of the instance. https://cloud.google.com/memorystore/docs/redis/reference/rest/v1/projects.locations.instances#Tier | `string` | `"STANDARD_HA"` | no | ## Outputs diff --git a/build/int.cloudbuild.yaml b/build/int.cloudbuild.yaml index 1645e834..3c378daf 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.11.6' + _DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '0.14' diff --git a/build/lint.cloudbuild.yaml b/build/lint.cloudbuild.yaml index 8159ed2f..86324dc0 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.11.6' + _DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '0.14' diff --git a/examples/basic/memorystore.tf b/examples/basic/memorystore.tf index 10aebfce..dcfdb9ed 100644 --- a/examples/basic/memorystore.tf +++ b/examples/basic/memorystore.tf @@ -15,7 +15,6 @@ */ provider "google" { - version = "~> 3.52.0" } module "memorystore" { diff --git a/examples/memcache/main.tf b/examples/memcache/main.tf index 6846457a..3f2e78f4 100644 --- a/examples/memcache/main.tf +++ b/examples/memcache/main.tf @@ -15,12 +15,11 @@ */ provider "google-beta" { - version = "~> 3.38.0" } module "private-service-access" { source = "GoogleCloudPlatform/sql-db/google//modules/private_service_access" - version = "3.2.0" + version = "~> 4.5" project_id = var.project vpc_network = "default" } diff --git a/main.tf b/main.tf index 1bf3678f..b7f35d99 100644 --- a/main.tf +++ b/main.tf @@ -41,7 +41,7 @@ resource "google_redis_instance" "default" { module "enable_apis" { source = "terraform-google-modules/project-factory/google//modules/project_services" - version = "9.2.0" + version = "~> 10.0" project_id = var.project enable_apis = var.enable_apis diff --git a/modules/memcache/README.md b/modules/memcache/README.md index abfc6757..f0799da1 100644 --- a/modules/memcache/README.md +++ b/modules/memcache/README.md @@ -6,20 +6,20 @@ A Terraform module for creating a fully functional Google Memorystore (memcache) ## Inputs | Name | Description | Type | Default | Required | -|------|-------------|:----:|:-----:|:-----:| -| authorized\_network | The full name of the Google Compute Engine network to which the instance is connected. If left unspecified, the default network will be used. | string | `"null"` | no | -| cpu\_count | Number of CPUs per node | number | `"1"` | no | -| display\_name | An arbitrary and optional user-provided name for the instance. | string | `"null"` | no | -| enable\_apis | Flag for enabling memcache.googleapis.com in your project | bool | `"true"` | no | -| labels | The resource labels to represent user provided metadata. | map(string) | `` | no | -| memory\_size\_mb | Memcache memory size in MiB. Defaulted to 1024 | number | `"1024"` | no | -| name | The ID of the instance or a fully qualified identifier for the instance. | string | n/a | yes | -| node\_count | Number of nodes in the memcache instance. | number | `"1"` | no | -| params | Parameters for the memcache process | map(string) | `"null"` | no | -| project | The ID of the project in which the resource belongs to. | string | n/a | yes | -| region | The GCP region to use. | string | n/a | yes | -| reserved\_ip\_range | The CIDR range of internal addresses that are reserved for this instance. | string | `"null"` | no | -| zones | Zones where memcache nodes should be provisioned. If not provided, all zones will be used. | list(string) | `"null"` | no | +|------|-------------|------|---------|:--------:| +| authorized\_network | The full name of the Google Compute Engine network to which the instance is connected. If left unspecified, the default network will be used. | `string` | `null` | no | +| cpu\_count | Number of CPUs per node | `number` | `1` | no | +| display\_name | An arbitrary and optional user-provided name for the instance. | `string` | `null` | no | +| enable\_apis | Flag for enabling memcache.googleapis.com in your project | `bool` | `true` | no | +| labels | The resource labels to represent user provided metadata. | `map(string)` | `{}` | no | +| memory\_size\_mb | Memcache memory size in MiB. Defaulted to 1024 | `number` | `1024` | no | +| name | The ID of the instance or a fully qualified identifier for the instance. | `string` | n/a | yes | +| node\_count | Number of nodes in the memcache instance. | `number` | `1` | no | +| params | Parameters for the memcache process | `map(string)` | `null` | no | +| project | The ID of the project in which the resource belongs to. | `string` | n/a | yes | +| region | The GCP region to use. | `string` | n/a | yes | +| reserved\_ip\_range | The CIDR range of internal addresses that are reserved for this instance. | `string` | `null` | no | +| zones | Zones where memcache nodes should be provisioned. If not provided, all zones will be used. | `list(string)` | `null` | no | ## Outputs diff --git a/modules/memcache/main.tf b/modules/memcache/main.tf index 0cd67b72..4dab08e3 100644 --- a/modules/memcache/main.tf +++ b/modules/memcache/main.tf @@ -43,7 +43,7 @@ resource "google_memcache_instance" "self" { module "enable_apis" { source = "terraform-google-modules/project-factory/google//modules/project_services" - version = "9.2.0" + version = "~> 10.0" project_id = var.project enable_apis = var.enable_apis diff --git a/test/fixtures/memcache/README.md b/test/fixtures/memcache/README.md index 3c0f6d65..1519e9b7 100644 --- a/test/fixtures/memcache/README.md +++ b/test/fixtures/memcache/README.md @@ -6,19 +6,19 @@ This test will create a new memcache instance. ## Inputs | Name | Description | Type | Default | Required | -|------|-------------|:----:|:-----:|:-----:| -| project\_id | Google cloud project id to create memcache instance. | string | n/a | yes | +|------|-------------|------|---------|:--------:| +| project\_id | Google cloud project id to create memcache instance. | `string` | n/a | yes | ## Outputs | Name | Description | |------|-------------| -| cpu\_count | | -| memory\_size\_mb | | -| name | | -| output\_id | | -| output\_region | | -| project\_id | | -| region | | +| cpu\_count | n/a | +| memory\_size\_mb | n/a | +| name | n/a | +| output\_id | n/a | +| output\_region | n/a | +| project\_id | n/a | +| region | n/a | diff --git a/test/fixtures/memcache/main.tf b/test/fixtures/memcache/main.tf index 74289267..0dd3fd51 100644 --- a/test/fixtures/memcache/main.tf +++ b/test/fixtures/memcache/main.tf @@ -14,10 +14,6 @@ * limitations under the License. */ -provider "google-beta" { - version = "~> 3.38.0" -} - module "memcache" { source = "../../../examples/memcache" project = var.project_id diff --git a/test/fixtures/minimal/README.md b/test/fixtures/minimal/README.md index d31a5e09..d1b4ab5c 100644 --- a/test/fixtures/minimal/README.md +++ b/test/fixtures/minimal/README.md @@ -6,26 +6,26 @@ This test will create a new redis instance. ## Inputs | Name | Description | Type | Default | Required | -|------|-------------|:----:|:-----:|:-----:| -| location\_id | Zone to create test instance. | string | `"us-east1-b"` | no | -| memory\_size\_gb | Memory size of test instance. | number | `"1"` | no | -| name | Name of redis instance. | string | `"test-minimal"` | no | -| project\_id | Google cloud project id to create redis instance. | string | n/a | yes | -| region | Region to create test instance. | string | `"us-east1"` | no | -| tier | The service tier of the instance. https://cloud.google.com/memorystore/docs/redis/reference/rest/v1/projects.locations.instances#Tier | string | `"BASIC"` | no | +|------|-------------|------|---------|:--------:| +| location\_id | Zone to create test instance. | `string` | `"us-east1-b"` | no | +| memory\_size\_gb | Memory size of test instance. | `number` | `1` | no | +| name | Name of redis instance. | `string` | `"test-minimal"` | no | +| project\_id | Google cloud project id to create redis instance. | `string` | n/a | yes | +| region | Region to create test instance. | `string` | `"us-east1"` | no | +| tier | The service tier of the instance. https://cloud.google.com/memorystore/docs/redis/reference/rest/v1/projects.locations.instances#Tier | `string` | `"BASIC"` | no | ## Outputs | Name | Description | |------|-------------| -| location\_id | | -| memory\_size\_gb | | -| name | | -| output\_current\_location\_id | | -| output\_host | | -| output\_id | | -| output\_region | | -| project\_id | | -| region | | +| location\_id | n/a | +| memory\_size\_gb | n/a | +| name | n/a | +| output\_current\_location\_id | n/a | +| output\_host | n/a | +| output\_id | n/a | +| output\_region | n/a | +| project\_id | n/a | +| region | n/a | diff --git a/test/fixtures/redis/README.md b/test/fixtures/redis/README.md index edd51e5f..75bc444d 100644 --- a/test/fixtures/redis/README.md +++ b/test/fixtures/redis/README.md @@ -6,31 +6,31 @@ This test will create a new redis instance. ## Inputs | Name | Description | Type | Default | Required | -|------|-------------|:----:|:-----:|:-----:| -| alternative\_location\_id | Alternate Zone to create test instance. | string | `"us-east1-d"` | no | -| auth\_enabled | Indicates whether OSS Redis AUTH is enabled for the instance. If set to true AUTH is enabled on the instance. | bool | `"true"` | no | -| auth\_string | AUTH String set on the instance. This field will only be populated if auth_enabled is true | string | `"null"` | no | -| location\_id | Zone to create test instance. | string | `"us-east1-b"` | no | -| memory\_size\_gb | Memory size of test instance. | number | `"1"` | no | -| name | Name of redis instance. | string | `"test-redis"` | no | -| project\_id | Google cloud project id to create redis instance. | string | n/a | yes | -| region | Region to create test instance. | string | `"us-east1"` | no | +|------|-------------|------|---------|:--------:| +| alternative\_location\_id | Alternate Zone to create test instance. | `string` | `"us-east1-d"` | no | +| auth\_enabled | Indicates whether OSS Redis AUTH is enabled for the instance. If set to true AUTH is enabled on the instance. | `bool` | `true` | no | +| auth\_string | AUTH String set on the instance. This field will only be populated if auth\_enabled is true | `string` | `null` | no | +| location\_id | Zone to create test instance. | `string` | `"us-east1-b"` | no | +| memory\_size\_gb | Memory size of test instance. | `number` | `1` | no | +| name | Name of redis instance. | `string` | `"test-redis"` | no | +| project\_id | Google cloud project id to create redis instance. | `string` | n/a | yes | +| region | Region to create test instance. | `string` | `"us-east1"` | no | ## Outputs | Name | Description | |------|-------------| -| alternative\_location\_id | | -| auth\_enabled | | -| auth\_string | | -| location\_id | | -| memory\_size\_gb | | -| name | | -| output\_current\_location\_id | | -| output\_host | | -| output\_id | | -| output\_region | | -| project\_id | | -| region | | +| alternative\_location\_id | n/a | +| auth\_enabled | n/a | +| auth\_string | n/a | +| location\_id | n/a | +| memory\_size\_gb | n/a | +| name | n/a | +| output\_current\_location\_id | n/a | +| output\_host | n/a | +| output\_id | n/a | +| output\_region | n/a | +| project\_id | n/a | +| region | n/a | diff --git a/test/setup/main.tf b/test/setup/main.tf index 93555791..eeea805d 100644 --- a/test/setup/main.tf +++ b/test/setup/main.tf @@ -16,7 +16,7 @@ module "project" { source = "terraform-google-modules/project-factory/google" - version = "~> 8.1.0" + version = "~> 10.2" name = "ci-memory-store" random_project_id = true diff --git a/test/setup/make_source.sh b/test/setup/make_source.sh deleted file mode 100755 index 5070f0e9..00000000 --- a/test/setup/make_source.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env bash - -# Copyright 2018 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. - -echo "#!/usr/bin/env bash" > ../source.sh - -project_id=$(terraform output project_id) -echo "export TF_VAR_project_id='$project_id'" >> ../source.sh - -sa_json=$(terraform output sa_key) -# shellcheck disable=SC2086 -echo "export SERVICE_ACCOUNT_JSON='$(echo $sa_json | base64 --decode)'" >> ../source.sh - -parent_id=$(terraform output parent_id) -echo "export TF_VAR_parent_id='$parent_id'" >> ../source.sh -echo "export TF_VAR_org_id='$parent_id'" >> ../source.sh diff --git a/test/setup/versions.tf b/test/setup/versions.tf index 2abe710f..29704272 100644 --- a/test/setup/versions.tf +++ b/test/setup/versions.tf @@ -17,11 +17,3 @@ terraform { required_version = ">= 0.12" } - -provider "google" { - version = "~> 3.52.0" -} - -provider "google-beta" { - version = "~> 3.52.0" -}