Skip to content

Commit

Permalink
lint: Fixing docs and linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
tfhartmann committed Oct 2, 2019
1 parent e413154 commit a2aed75
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docs/upgrading_to_v2.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
6 changes: 3 additions & 3 deletions examples/submodule_svpc_access/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 | `<list>` | no |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
2 changes: 1 addition & 1 deletion modules/fabric-net-svpc-access/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
19 changes: 16 additions & 3 deletions scripts/migrate.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit a2aed75

Please sign in to comment.