From a2aed753b156d91b4f89a2bc1300abbf3e910e8a Mon Sep 17 00:00:00 2001 From: Tim Hartmann Date: Wed, 2 Oct 2019 14:54:19 -0400 Subject: [PATCH] lint: Fixing docs and linting errors --- docs/upgrading_to_v2.0.md | 2 +- examples/submodule_svpc_access/README.md | 6 +++--- modules/fabric-net-svpc-access/README.md | 2 +- scripts/migrate.sh | 19 ++++++++++++++++--- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/docs/upgrading_to_v2.0.md b/docs/upgrading_to_v2.0.md index 17711e6b3..ea7bd714c 100644 --- a/docs/upgrading_to_v2.0.md +++ b/docs/upgrading_to_v2.0.md @@ -7,7 +7,7 @@ Because v2.x changed how the subnet resource is iterated on, resources in Terraf ## Migration Instructions -- Upgrade to the new version of this module. +- Upgrade to the new version of this module. if you run `terraform plan` at this point. Terraform will inform you that it will attempt to delete and recreate your existing subnets. This is almost certainly not the behavior you want. For example: diff --git a/examples/submodule_svpc_access/README.md b/examples/submodule_svpc_access/README.md index 38b9b05ee..c8e66b959 100644 --- a/examples/submodule_svpc_access/README.md +++ b/examples/submodule_svpc_access/README.md @@ -17,8 +17,8 @@ Subnet-level access in this example is only granted to the default GCE service a |------|-------------|:----:|:-----:|:-----:| | host\_project\_id | Id of the host project where the shared VPC will be created. | string | n/a | yes | | network\_name | Name of the shared VPC. | string | `"test-svpc"` | no | -| service\_project\_id\_full\_access | Id of the service project that will get VPC-level access. | string | n/a | yes | -| service\_project\_number\_first\_subnet | Project number to derive service accounts with access to first subnet. | string | n/a | yes | -| service\_project\_number\_multi\_subnet | Project number to derive service accounts with access to first and second subnet. | string | n/a | yes | +| service\_project\_id | Service project id. | string | n/a | yes | +| service\_project\_number | Service project number. | string | n/a | yes | +| service\_project\_owners | Service project owners, in IAM format. | list | `` | no | diff --git a/modules/fabric-net-svpc-access/README.md b/modules/fabric-net-svpc-access/README.md index 962ee8f0c..dbe759cd4 100644 --- a/modules/fabric-net-svpc-access/README.md +++ b/modules/fabric-net-svpc-access/README.md @@ -5,7 +5,7 @@ This module allows configuring service project access to a Shared VPC, created w - attaching service projects to the Shared VPC host project - assigning IAM roles for each Shared VPC subnet -Full details on service project configuration can be found in the Google Cloud documentation on *[Provisioning Shared VPC](https://cloud.google.com/vpc/docs/provisioning-shared-vpc)*, and to *[Setting up clusters with Shared VPC](https://cloud.google.com/kubernetes-engine/docs/how-to/cluster-shared-vpc)*. Details and use cases of using service accounts as role recipients for Shared VPC are in the *[Service accounts as project admins](https://cloud.google.com/vpc/docs/provisioning-shared-vpc#sa-as-spa)* section of the first document above. +Full details on service project configuration can be found in the Google Cloud documentation on *[Provisioning Shared VPC](https://cloud.google.com/vpc/docs/provisioning-shared-vpc)*, and to *[Setting up clusters with Shared VPC](https://cloud.google.com/kubernetes-engine/docs/how-to/cluster-shared-vpc)*. Details and use cases of using service accounts as role recipients for Shared VPC are in the *[Service accounts as project admins](https://cloud.google.com/vpc/docs/provisioning-shared-vpc#sa-as-spa)* section of the first document above. The resources created/managed by this module are: diff --git a/scripts/migrate.sh b/scripts/migrate.sh index 69658434c..a36e2d8c2 100755 --- a/scripts/migrate.sh +++ b/scripts/migrate.sh @@ -1,13 +1,26 @@ #!/usr/bin/env bash +# Copyright 2019 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. # shellcheck shell=bash # Output Terraform Commands to migrate to new subnet config set -e set -o pipefail if [[ "$MODULE_NAME" ]]; then - NAME=$(terraform state list | grep ${MODULE_NAME}.google_compute_network.network | sed 's/.google_compute_network.network//') - for x in $(terraform state list | grep ${NAME}.google_compute_subnetwork.subnetwork); do - ID=$(terraform state show $x | grep id | grep -v ip_cidr_range | awk '{ print $3 }'| tr -d '"') + NAME=$(terraform state list | grep "${MODULE_NAME}".google_compute_network.network | sed 's/.google_compute_network.network//') + for x in $(terraform state list | grep "${NAME}".google_compute_subnetwork.subnetwork); do + ID=$(terraform state show "$x" | grep id | grep -v ip_cidr_range | awk '{ print $3 }'| tr -d '"') echo "terraform state mv $x ${NAME}.google_compute_subnetwork.subnetwork[\\\"${ID}\\\"]" done else