Skip to content

Commit

Permalink
#387 - 5-af - tef 20240511
Browse files Browse the repository at this point in the history
  • Loading branch information
obriensystems committed May 12, 2024
1 parent 38bc820 commit 6fbaf12
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 33 deletions.
22 changes: 11 additions & 11 deletions 5-app-infra/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ organizational policies.</td>
</tr>
<tr>
<td><a href="../2-environments"><span style="white-space: nowrap;">2-environments</span></a></td>
<td>Sets up development, non-production, and production environments within the
<td>Sets up development, nonproduction, and production environments within the
Google Cloud organization that you've created.</td>
</tr>
<tr>
Expand Down Expand Up @@ -176,12 +176,12 @@ Run `terraform output cloudbuild_project_id` in the `0-bootstrap` folder to get
git push origin development
```

1. Merge changes to non-production. Because this is a [named environment branch](../docs/FAQ.md#what-is-a-named-branch),
1. Merge changes to nonproduction. Because this is a [named environment branch](../docs/FAQ.md#what-is-a-named-branch),
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_INFRA_PIPELINE_PROJECT_ID

```bash
git checkout -b non-production
git push origin non-production
git checkout -b nonproduction
git push origin nonproduction
```

1. Merge changes to production branch. Because this is a [named environment branch](../docs/FAQ.md#what-is-a-named-branch),
Expand Down Expand Up @@ -242,7 +242,7 @@ Run `terraform output cloudbuild_project_id` in the `0-bootstrap` folder to get
for i in `find . -name 'backend.tf'`; do sed -i'' -e "s/UPDATE_APP_INFRA_BUCKET/${backend_bucket}/" $i; done
```

We will now deploy each of our environments (development/production/non-production) using this script.
We will now deploy each of our environments (development/production/nonproduction) using this script.
When using Cloud Build or Jenkins as your CI/CD tool, each environment corresponds to a branch in the repository for the `5-app-infra` step. Only the corresponding environment is applied.

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.
Expand Down Expand Up @@ -276,23 +276,23 @@ To use the `validate` option of the `tf-wrapper.sh` script, please follow the [i
./tf-wrapper.sh apply production
```

1. Run `init` and `plan` and review output for environment non-production.
1. Run `init` and `plan` and review output for environment nonproduction.

```bash
./tf-wrapper.sh init non-production
./tf-wrapper.sh plan non-production
./tf-wrapper.sh init nonproduction
./tf-wrapper.sh plan nonproduction
```

1. Run `validate` and check for violations.

```bash
./tf-wrapper.sh validate non-production $(pwd)/../policy-library ${INFRA_PIPELINE_PROJECT_ID}
./tf-wrapper.sh validate nonproduction $(pwd)/../policy-library ${INFRA_PIPELINE_PROJECT_ID}
```

1. Run `apply` non-production.
1. Run `apply` nonproduction.

```bash
./tf-wrapper.sh apply non-production
./tf-wrapper.sh apply nonproduction
```

1. Run `init` and `plan` and review output for environment development.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
terraform {
backend "gcs" {
bucket = "UPDATE_APP_INFRA_BUCKET"
prefix = "terraform/app-infra/business_unit_1/non-production"
prefix = "terraform/app-infra/business_unit_1/nonproduction"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

locals {
business_unit = "business_unit_1"
environment = "non-production"
environment = "nonproduction"
}

module "base_shared_gce_instance" {
Expand Down
2 changes: 1 addition & 1 deletion 5-app-infra/common.auto.example.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
* limitations under the License.
*/

instance_region = "us-central1" // should be one of the regions used to create network on step 3-networks
instance_region = "northamerica-northeast1" // should be one of the regions used to create network on step 3-networks

remote_state_bucket = "REMOTE_STATE_BUCKET"
19 changes: 0 additions & 19 deletions 5-app-infra/common.auto.mod.tfvars

This file was deleted.

0 comments on commit 6fbaf12

Please sign in to comment.