Skip to content

Commit

Permalink
Merge pull request #108 from amandakarina/fix/fix-bu2-copy-command
Browse files Browse the repository at this point in the history
Fixes business_unit_2 commands
  • Loading branch information
amandakarina authored Aug 19, 2024
2 parents a60b76b + a5f4d2c commit 7c01f93
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
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 @@ -293,6 +295,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

0 comments on commit 7c01f93

Please sign in to comment.