Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes business_unit_2 commands #108

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions 4-projects/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ For example, to create a new business unit similar to business_unit_1, run the f
# search all files under the folder `business_unit_2` and replace strings for business_unit_1 with strings for business_unit_2
grep -rl bu1 business_unit_2/ | xargs sed -i 's/bu1/bu2/g'
grep -rl business_unit_1 business_unit_2/ | xargs sed -i 's/business_unit_1/business_unit_2/g'
# search subnet_ip_range 10.3.64.0 and replace for the new range 10.4.64.0
grep -rl 10.3.64.0 business_unit_2/ | xargs sed -i 's/10.3.64.0/10.4.64.0/g'
```

1. Commit changes.
Expand Down Expand Up @@ -292,6 +294,22 @@ To use the `validate` option of the `tf-wrapper.sh` script, please follow the [i
echo ${GOOGLE_IMPERSONATE_SERVICE_ACCOUNT}
```


1. (Optional) If you want additional subfolders for separate business units or entities, make additional copies of the folder `business_unit_1` and modify any values that vary across business unit like `business_code`, `business_unit`, or `subnet_ip_range`.

For example, to create a new business unit similar to business_unit_1, run the following:

```bash
#copy the business_unit_1 folder and it's contents to a new folder business_unit_2
cp -r business_unit_1 business_unit_2

# search all files under the folder `business_unit_2` and replace strings for business_unit_1 with strings for business_unit_2
grep -rl bu1 business_unit_2/ | xargs sed -i 's/bu1/bu2/g'
grep -rl business_unit_1 business_unit_2/ | xargs sed -i 's/business_unit_1/business_unit_2/g'
# search subnet_ip_range 10.3.64.0 and replace for the new range 10.4.64.0
grep -rl 10.3.64.0 business_unit_2/ | xargs sed -i 's/10.3.64.0/10.4.64.0/g'
```

1. Checkout `shared` branch. Run `init` and `plan` and review output for environment shared.

```bash
Expand Down
1 change: 1 addition & 0 deletions 4-projects/business_unit_1/development/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ module "env" {
remote_state_bucket = var.remote_state_bucket
location_kms = coalesce(var.location_kms, local.default_region_kms)
location_gcs = coalesce(var.location_gcs, local.default_region_gcs)
keyring_name = "bu1-sample-keyring"
gcs_custom_placement_config = {
data_locations = [
upper(local.default_region),
Expand Down
1 change: 1 addition & 0 deletions 4-projects/business_unit_1/nonproduction/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module "env" {
business_unit = "business_unit_1"
remote_state_bucket = var.remote_state_bucket
location_kms = coalesce(var.location_kms, local.default_region_kms)
keyring_name = "bu1-sample-keyring"
location_gcs = coalesce(var.location_gcs, local.default_region_gcs)
gcs_custom_placement_config = {
data_locations = [
Expand Down
1 change: 1 addition & 0 deletions 4-projects/business_unit_1/production/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module "env" {
business_unit = "business_unit_1"
remote_state_bucket = var.remote_state_bucket
location_kms = coalesce(var.location_kms, local.default_region_kms)
keyring_name = "bu1-sample-keyring"
location_gcs = coalesce(var.location_gcs, local.default_region_gcs)
gcs_custom_placement_config = {
data_locations = [
Expand Down