Skip to content

Commit 5077d75

Browse files
update README instructions
1 parent 2035566 commit 5077d75

File tree

1 file changed

+51
-52
lines changed

1 file changed

+51
-52
lines changed

3-networks-dual-svpc/README.md

Lines changed: 51 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -195,15 +195,10 @@ Run `terraform output cloudbuild_project_id` in the `0-bootstrap` folder to get
195195

196196
```bash
197197
git add .
198-
git commit -m 'Initialize networks repo - plan'
199-
```
200-
201-
1. You must manually plan and apply the `production` environment since the `development`, `nonproduction` and `plan` environments depend on it.
202-
203-
```bash
204-
git checkout -b production
198+
git commit -m 'Initialize networks repo'
205199
```
206200

201+
1. You must manually plan and apply the `shared` environment (only once) since the `development`, `nonproduction` and `production` environments depend on it.
207202
1. To use the `validate` option of the `tf-wrapper.sh` script, please follow the [instructions](https://cloud.google.com/docs/terraform/policy-validation/validate-policies#install) to install the terraform-tools component.
208203
1. Use `terraform output` to get the Cloud Build project ID and the networks step Terraform Service Account from 0-bootstrap output. An environment variable `GOOGLE_IMPERSONATE_SERVICE_ACCOUNT` will be set using the Terraform Service Account to enable impersonation.
209204

@@ -215,53 +210,51 @@ Run `terraform output cloudbuild_project_id` in the `0-bootstrap` folder to get
215210
echo ${GOOGLE_IMPERSONATE_SERVICE_ACCOUNT}
216211
```
217212

218-
1. Run `init` and `plan` and review output for environment production.
213+
1. Run `init` and `plan` and review output for environment shared.
219214

220215
```bash
221-
./tf-wrapper.sh init production
222-
./tf-wrapper.sh plan production
216+
./tf-wrapper.sh init shared
217+
./tf-wrapper.sh plan shared
223218
```
224219

225220
1. Run `validate` and check for violations.
226221

227222
```bash
228-
./tf-wrapper.sh validate production $(pwd)/../gcp-policies ${CLOUD_BUILD_PROJECT_ID}
223+
./tf-wrapper.sh validate shared $(pwd)/../gcp-policies ${CLOUD_BUILD_PROJECT_ID}
229224
```
230225

231-
1. Run `apply` production.
226+
1. Run `apply` shared.
232227

233228
```bash
234-
./tf-wrapper.sh apply production
229+
./tf-wrapper.sh apply shared
235230
```
236231

237-
1. Push your production branch since development and nonproduction depends it. Because this is a [named environment branch](../docs/FAQ.md#what-is-a-named-branch),
238-
pushing to this branch triggers both _terraform plan_ and _terraform apply_. Review the apply output in your Cloud Build project https://console.cloud.google.com/cloud-build/builds;region=DEFAULT_REGION?project=YOUR_CLOUD_BUILD_PROJECT_ID
239-
240-
*Note:** The Production envrionment must be the first branch to be pushed as it includes the DNS Hub communication that will be used by other environments.
232+
1. You must manually plan and apply the `production` environment since the `development`, `nonproduction` and `plan` environments depend on it.
241233

242234
```bash
243-
git push --set-upstream origin production
235+
git checkout -b production
244236
```
245237

246-
1. You must manually plan and apply the `shared` environment (only once) since the `development`, `nonproduction` and `production` environments depend on it.
247-
248-
1. Run `init` and `plan` and review output for environment shared.
238+
1. Run `init` and `plan` and review output for environment production.
249239

250240
```bash
251-
./tf-wrapper.sh init shared
252-
./tf-wrapper.sh plan shared
241+
./tf-wrapper.sh init production
242+
./tf-wrapper.sh plan production
253243
```
254244

255-
1. Run `validate` and check for violations.
245+
1. Run `apply` production.
256246

257247
```bash
258-
./tf-wrapper.sh validate shared $(pwd)/../gcp-policies ${CLOUD_BUILD_PROJECT_ID}
248+
./tf-wrapper.sh apply production
259249
```
260250

261-
1. Run `apply` shared.
251+
1. Push your production branch since development and nonproduction depends it. Because this is a [named environment branch](../docs/FAQ.md#what-is-a-named-branch),
252+
pushing to this branch triggers both _terraform plan_ and _terraform apply_. Review the apply output in your Cloud Build project https://console.cloud.google.com/cloud-build/builds;region=DEFAULT_REGION?project=YOUR_CLOUD_BUILD_PROJECT_ID
253+
254+
*Note:** The Production envrionment must be the first branch to be pushed as it includes the DNS Hub communication that will be used by other environments.
262255

263256
```bash
264-
./tf-wrapper.sh apply shared
257+
git push --set-upstream origin production
265258
```
266259

267260
1. Push your plan branch to trigger a plan for all environments. Because the
@@ -325,9 +318,9 @@ See `0-bootstrap` [README-GitHub.md](../0-bootstrap/README-GitHub.md#deploying-s
325318
git init
326319
git commit -m "initialize empty directory" --allow-empty
327320
git checkout -b shared
321+
git checkout -b production
328322
git checkout -b development
329323
git checkout -b nonproduction
330-
git checkout -b production
331324
```
332325

333326
1. Rename `common.auto.example.tfvars` to `common.auto.tfvars`, rename `production.auto.example.tfvars` to `production.auto.tfvars` and rename `access_context.auto.example.tfvars` to `access_context.auto.tfvars`.
@@ -388,6 +381,36 @@ To use the `validate` option of the `tf-wrapper.sh` script, please follow the [i
388381

389382
```bash
390383
./tf-wrapper.sh apply shared
384+
```
385+
386+
1. Checkout shared `production`. Run `init` and `plan` and review output for environment production.
387+
388+
```bash
389+
git checkout production
390+
git merge shared
391+
./tf-wrapper.sh init production
392+
./tf-wrapper.sh plan production
393+
```
394+
395+
1. Run `validate` and check for violations.
396+
397+
```bash
398+
./tf-wrapper.sh validate production $(pwd)/../gcp-policies ${SEED_PROJECT_ID}
399+
```
400+
401+
1. Run `apply` production.
402+
403+
```bash
404+
./tf-wrapper.sh apply production
405+
git add .
406+
git commit -m "Initial production commit."
407+
cd ../
408+
```
409+
410+
1. Run `git commit` shared.
411+
412+
```bash
413+
git checkout shared
391414
git add .
392415
git commit -m "Initial shared commit."
393416
```
@@ -438,30 +461,6 @@ To use the `validate` option of the `tf-wrapper.sh` script, please follow the [i
438461
git commit -m "Initial nonproduction commit."
439462
```
440463

441-
1. Checkout shared `production`. Run `init` and `plan` and review output for environment development.
442-
443-
```bash
444-
git checkout production
445-
git merge nonproduction
446-
./tf-wrapper.sh init production
447-
./tf-wrapper.sh plan production
448-
```
449-
450-
1. Run `validate` and check for violations.
451-
452-
```bash
453-
./tf-wrapper.sh validate production $(pwd)/../gcp-policies ${SEED_PROJECT_ID}
454-
```
455-
456-
1. Run `apply` production.
457-
458-
```bash
459-
./tf-wrapper.sh apply production
460-
git add .
461-
git commit -m "Initial production commit."
462-
cd ../
463-
```
464-
465464
If you received any errors or made any changes to the Terraform config or any `.tfvars`, you must re-run `./tf-wrapper.sh plan <env>` before run `./tf-wrapper.sh apply <env>`.
466465

467466
Before executing the next stages, unset the `GOOGLE_IMPERSONATE_SERVICE_ACCOUNT` environment variable.

0 commit comments

Comments
 (0)