From 90e0fa8ae735a84d26f8bea7a01064c1e170edbf Mon Sep 17 00:00:00 2001 From: Elliot Date: Thu, 16 May 2024 15:49:06 +0000 Subject: [PATCH 1/2] Remove extra projects from business_unit_2 to help improve CI tests. Update readme with directions to optionally recreate. --- 0-bootstrap/README-GitHub.md | 16 +++ 0-bootstrap/README-GitLab.md | 14 +++ 0-bootstrap/README-Jenkins.md | 14 +++ 0-bootstrap/README-Terraform-Cloud.md | 14 +++ 4-projects/README.md | 28 +++++ .../business_unit_2/development/README.md | 37 ------ .../business_unit_2/development/backend.tf | 22 ---- .../development/backend.tf.cloud.example | 23 ---- .../development/common.auto.tfvars | 1 - .../development/development.auto.tfvars | 1 - .../business_unit_2/development/main.tf | 31 ----- .../business_unit_2/development/outputs.tf | 110 ------------------ .../business_unit_2/development/variables.tf | 50 -------- .../business_unit_2/nonproduction/README.md | 37 ------ .../business_unit_2/nonproduction/backend.tf | 22 ---- .../nonproduction/backend.tf.cloud.example | 23 ---- .../nonproduction/common.auto.tfvars | 1 - .../business_unit_2/nonproduction/main.tf | 31 ----- .../nonproduction/nonproduction.auto.tfvars | 1 - .../business_unit_2/nonproduction/outputs.tf | 110 ------------------ .../nonproduction/variables.tf | 50 -------- .../business_unit_2/production/README.md | 37 ------ .../business_unit_2/production/backend.tf | 22 ---- .../production/backend.tf.cloud.example | 23 ---- .../production/common.auto.tfvars | 1 - 4-projects/business_unit_2/production/main.tf | 31 ----- .../business_unit_2/production/outputs.tf | 110 ------------------ .../production/production.auto.tfvars | 1 - .../business_unit_2/production/variables.tf | 50 -------- 4-projects/business_unit_2/shared/README.md | 26 ----- 4-projects/business_unit_2/shared/backend.tf | 22 ---- .../shared/backend.tf.cloud.example | 23 ---- .../business_unit_2/shared/common.auto.tfvars | 1 - .../shared/example_infra_pipeline.tf | 71 ----------- 4-projects/business_unit_2/shared/outputs.tf | 64 ---------- 4-projects/business_unit_2/shared/remote.tf | 48 -------- .../shared/remote.tf.cloud.example | 40 ------- .../business_unit_2/shared/shared.auto.tfvars | 1 - .../business_unit_2/shared/variables.tf | 49 -------- 39 files changed, 86 insertions(+), 1170 deletions(-) delete mode 100644 4-projects/business_unit_2/development/README.md delete mode 100644 4-projects/business_unit_2/development/backend.tf delete mode 100644 4-projects/business_unit_2/development/backend.tf.cloud.example delete mode 120000 4-projects/business_unit_2/development/common.auto.tfvars delete mode 120000 4-projects/business_unit_2/development/development.auto.tfvars delete mode 100644 4-projects/business_unit_2/development/main.tf delete mode 100644 4-projects/business_unit_2/development/outputs.tf delete mode 100644 4-projects/business_unit_2/development/variables.tf delete mode 100644 4-projects/business_unit_2/nonproduction/README.md delete mode 100644 4-projects/business_unit_2/nonproduction/backend.tf delete mode 100644 4-projects/business_unit_2/nonproduction/backend.tf.cloud.example delete mode 120000 4-projects/business_unit_2/nonproduction/common.auto.tfvars delete mode 100644 4-projects/business_unit_2/nonproduction/main.tf delete mode 120000 4-projects/business_unit_2/nonproduction/nonproduction.auto.tfvars delete mode 100644 4-projects/business_unit_2/nonproduction/outputs.tf delete mode 100644 4-projects/business_unit_2/nonproduction/variables.tf delete mode 100644 4-projects/business_unit_2/production/README.md delete mode 100644 4-projects/business_unit_2/production/backend.tf delete mode 100644 4-projects/business_unit_2/production/backend.tf.cloud.example delete mode 120000 4-projects/business_unit_2/production/common.auto.tfvars delete mode 100644 4-projects/business_unit_2/production/main.tf delete mode 100644 4-projects/business_unit_2/production/outputs.tf delete mode 120000 4-projects/business_unit_2/production/production.auto.tfvars delete mode 100644 4-projects/business_unit_2/production/variables.tf delete mode 100644 4-projects/business_unit_2/shared/README.md delete mode 100644 4-projects/business_unit_2/shared/backend.tf delete mode 100644 4-projects/business_unit_2/shared/backend.tf.cloud.example delete mode 120000 4-projects/business_unit_2/shared/common.auto.tfvars delete mode 100644 4-projects/business_unit_2/shared/example_infra_pipeline.tf delete mode 100644 4-projects/business_unit_2/shared/outputs.tf delete mode 100644 4-projects/business_unit_2/shared/remote.tf delete mode 100644 4-projects/business_unit_2/shared/remote.tf.cloud.example delete mode 120000 4-projects/business_unit_2/shared/shared.auto.tfvars delete mode 100644 4-projects/business_unit_2/shared/variables.tf diff --git a/0-bootstrap/README-GitHub.md b/0-bootstrap/README-GitHub.md index dfa1390ca..5a4472dff 100644 --- a/0-bootstrap/README-GitHub.md +++ b/0-bootstrap/README-GitHub.md @@ -823,6 +823,8 @@ An environment variable `GOOGLE_IMPERSONATE_SERVICE_ACCOUNT` will be set with th cd gcp-projects ``` + + 1. Seed the repository if it has not been initialized yet. ```bash @@ -878,6 +880,20 @@ An environment variable `GOOGLE_IMPERSONATE_SERVICE_ACCOUNT` will be set with th sed -i'' -e "s/REMOTE_STATE_BUCKET/${remote_state_bucket}/" ./common.auto.tfvars ``` +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' + ``` + + 1. Commit changes. ```bash diff --git a/0-bootstrap/README-GitLab.md b/0-bootstrap/README-GitLab.md index 96f066a74..862bade17 100644 --- a/0-bootstrap/README-GitLab.md +++ b/0-bootstrap/README-GitLab.md @@ -837,6 +837,20 @@ An environment variable `GOOGLE_IMPERSONATE_SERVICE_ACCOUNT` will be set with th sed -i'' -e "s/REMOTE_STATE_BUCKET/${remote_state_bucket}/" ./common.auto.tfvars ``` +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' + ``` + + 1. Commit changes. ```bash diff --git a/0-bootstrap/README-Jenkins.md b/0-bootstrap/README-Jenkins.md index 469e25694..688772522 100644 --- a/0-bootstrap/README-Jenkins.md +++ b/0-bootstrap/README-Jenkins.md @@ -886,6 +886,20 @@ Here you will configure a VPN Network tunnel to enable connectivity between the sed -i'' -e "s/REMOTE_STATE_BUCKET/${backend_bucket}/" ./common.auto.tfvars ``` +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' + ``` + + 1. Commit changes. ```bash diff --git a/0-bootstrap/README-Terraform-Cloud.md b/0-bootstrap/README-Terraform-Cloud.md index 256ae2446..0239aa984 100644 --- a/0-bootstrap/README-Terraform-Cloud.md +++ b/0-bootstrap/README-Terraform-Cloud.md @@ -862,6 +862,20 @@ An environment variable `GOOGLE_IMPERSONATE_SERVICE_ACCOUNT` will be set with th terraform -chdir="business_unit_2/shared/" init ``` +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' + ``` + + 1. Commit changes ```bash diff --git a/4-projects/README.md b/4-projects/README.md index f1653070d..cd2c517dc 100644 --- a/4-projects/README.md +++ b/4-projects/README.md @@ -134,6 +134,20 @@ Run `terraform output cloudbuild_project_id` in the `0-bootstrap` folder to get sed -i'' -e "s/REMOTE_STATE_BUCKET/${remote_state_bucket}/" ./common.auto.tfvars ``` +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' + ``` + + 1. Commit changes. ```bash @@ -268,6 +282,20 @@ 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' + ``` + + 1. Run `init` and `plan` and review output for environment shared. ```bash diff --git a/4-projects/business_unit_2/development/README.md b/4-projects/business_unit_2/development/README.md deleted file mode 100644 index b6841087a..000000000 --- a/4-projects/business_unit_2/development/README.md +++ /dev/null @@ -1,37 +0,0 @@ - -## Inputs - -| Name | Description | Type | Default | Required | -|------|-------------|------|---------|:--------:| -| instance\_region | Region which the peered subnet will be created (Should be same region as the VM that will be created on step 5-app-infra on the peering project). | `string` | `"us-central1"` | no | -| location\_gcs | Case-Sensitive Location for GCS Bucket (Should be same region as the KMS Keyring) | `string` | `"US"` | no | -| location\_kms | Case-Sensitive Location for KMS Keyring (Should be same region as the GCS Bucket) | `string` | `"us"` | no | -| peering\_module\_depends\_on | List of modules or resources peering module depends on. | `list(any)` | `[]` | no | -| remote\_state\_bucket | Backend bucket to load Terraform Remote State Data from previous steps. | `string` | n/a | yes | -| tfc\_org\_name | Name of the TFC organization. | `string` | `""` | no | - -## Outputs - -| Name | Description | -|------|-------------| -| access\_context\_manager\_policy\_id | Access Context Manager Policy ID. | -| base\_shared\_vpc\_project | Project sample base project. | -| base\_shared\_vpc\_project\_sa | Project sample base project SA. | -| base\_subnets\_self\_links | The self-links of subnets from base environment. | -| bucket | The created storage bucket. | -| env\_kms\_project | Project sample for KMS usage project ID. | -| floating\_project | Project sample floating project. | -| iap\_firewall\_tags | The security tags created for IAP (SSH and RDP) firewall rules and to be used on the VM created on step 5-app-infra on the peering network project. | -| keyring | The name of the keyring. | -| keys | List of created key names. | -| peering\_complete | Output to be used as a module dependency. | -| peering\_network | Peer network peering resource. | -| peering\_project | Project sample peering project id. | -| peering\_subnetwork\_self\_link | The subnetwork self link of the peering network. | -| restricted\_enabled\_apis | Activated APIs. | -| restricted\_shared\_vpc\_project | Project sample restricted project id. | -| restricted\_shared\_vpc\_project\_number | Project sample restricted project. | -| restricted\_subnets\_self\_links | The self-links of subnets from restricted environment. | -| vpc\_service\_control\_perimeter\_name | VPC Service Control name. | - - diff --git a/4-projects/business_unit_2/development/backend.tf b/4-projects/business_unit_2/development/backend.tf deleted file mode 100644 index 1505fcecf..000000000 --- a/4-projects/business_unit_2/development/backend.tf +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright 2021 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. - */ - -terraform { - backend "gcs" { - bucket = "UPDATE_PROJECTS_BACKEND" - prefix = "terraform/projects/business_unit_2/development" - } -} diff --git a/4-projects/business_unit_2/development/backend.tf.cloud.example b/4-projects/business_unit_2/development/backend.tf.cloud.example deleted file mode 100644 index f1893f851..000000000 --- a/4-projects/business_unit_2/development/backend.tf.cloud.example +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright 2023 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. - */ - -terraform { - cloud { - workspaces { - name = "4-bu2-development" - } - } -} diff --git a/4-projects/business_unit_2/development/common.auto.tfvars b/4-projects/business_unit_2/development/common.auto.tfvars deleted file mode 120000 index 39aaa4621..000000000 --- a/4-projects/business_unit_2/development/common.auto.tfvars +++ /dev/null @@ -1 +0,0 @@ -../../common.auto.tfvars \ No newline at end of file diff --git a/4-projects/business_unit_2/development/development.auto.tfvars b/4-projects/business_unit_2/development/development.auto.tfvars deleted file mode 120000 index 0351835de..000000000 --- a/4-projects/business_unit_2/development/development.auto.tfvars +++ /dev/null @@ -1 +0,0 @@ -../../development.auto.tfvars \ No newline at end of file diff --git a/4-projects/business_unit_2/development/main.tf b/4-projects/business_unit_2/development/main.tf deleted file mode 100644 index caf741ec0..000000000 --- a/4-projects/business_unit_2/development/main.tf +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright 2022 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. - */ - -module "env" { - source = "../../modules/base_env" - - env = "development" - business_code = "bu2" - business_unit = "business_unit_2" - remote_state_bucket = var.remote_state_bucket - location_kms = var.location_kms - location_gcs = var.location_gcs - tfc_org_name = var.tfc_org_name - peering_module_depends_on = var.peering_module_depends_on - peering_iap_fw_rules_enabled = true - subnet_region = var.instance_region - subnet_ip_range = "10.4.64.0/21" -} diff --git a/4-projects/business_unit_2/development/outputs.tf b/4-projects/business_unit_2/development/outputs.tf deleted file mode 100644 index 6f07af601..000000000 --- a/4-projects/business_unit_2/development/outputs.tf +++ /dev/null @@ -1,110 +0,0 @@ -/** - * Copyright 2021 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. - */ - -output "base_shared_vpc_project" { - description = "Project sample base project." - value = module.env.base_shared_vpc_project -} - -output "base_shared_vpc_project_sa" { - description = "Project sample base project SA." - value = module.env.base_shared_vpc_project_sa -} - -output "base_subnets_self_links" { - value = module.env.base_subnets_self_links - description = "The self-links of subnets from base environment." -} - -output "floating_project" { - description = "Project sample floating project." - value = module.env.floating_project -} - -output "peering_project" { - description = "Project sample peering project id." - value = module.env.peering_project -} - -output "peering_network" { - description = "Peer network peering resource." - value = module.env.peering_network -} - -output "restricted_shared_vpc_project" { - description = "Project sample restricted project id." - value = module.env.restricted_shared_vpc_project -} - -output "restricted_shared_vpc_project_number" { - description = "Project sample restricted project." - value = module.env.restricted_shared_vpc_project_number -} - -output "restricted_subnets_self_links" { - value = module.env.restricted_subnets_self_links - description = "The self-links of subnets from restricted environment." -} - -output "vpc_service_control_perimeter_name" { - description = "VPC Service Control name." - value = module.env.vpc_service_control_perimeter_name -} - -output "restricted_enabled_apis" { - description = "Activated APIs." - value = module.env.restricted_enabled_apis -} - -output "access_context_manager_policy_id" { - description = "Access Context Manager Policy ID." - value = module.env.access_context_manager_policy_id -} - -output "peering_complete" { - description = "Output to be used as a module dependency." - value = module.env.peering_complete -} - -output "env_kms_project" { - description = "Project sample for KMS usage project ID." - value = module.env.env_kms_project -} - -output "keyring" { - description = "The name of the keyring." - value = module.env.keyring -} - -output "keys" { - description = "List of created key names." - value = module.env.keys -} - -output "bucket" { - description = "The created storage bucket." - value = module.env.bucket -} - -output "peering_subnetwork_self_link" { - description = "The subnetwork self link of the peering network." - value = module.env.peering_subnetwork_self_link -} - -output "iap_firewall_tags" { - description = "The security tags created for IAP (SSH and RDP) firewall rules and to be used on the VM created on step 5-app-infra on the peering network project." - value = module.env.iap_firewall_tags -} diff --git a/4-projects/business_unit_2/development/variables.tf b/4-projects/business_unit_2/development/variables.tf deleted file mode 100644 index b337bae90..000000000 --- a/4-projects/business_unit_2/development/variables.tf +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Copyright 2021 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. - */ - -variable "remote_state_bucket" { - description = "Backend bucket to load Terraform Remote State Data from previous steps." - type = string -} - -variable "location_kms" { - description = "Case-Sensitive Location for KMS Keyring (Should be same region as the GCS Bucket)" - type = string - default = "us" -} - -variable "location_gcs" { - description = "Case-Sensitive Location for GCS Bucket (Should be same region as the KMS Keyring)" - type = string - default = "US" -} - -variable "peering_module_depends_on" { - description = "List of modules or resources peering module depends on." - type = list(any) - default = [] -} - -variable "tfc_org_name" { - description = "Name of the TFC organization." - type = string - default = "" -} - -variable "instance_region" { - description = "Region which the peered subnet will be created (Should be same region as the VM that will be created on step 5-app-infra on the peering project)." - type = string - default = "us-central1" -} diff --git a/4-projects/business_unit_2/nonproduction/README.md b/4-projects/business_unit_2/nonproduction/README.md deleted file mode 100644 index bb68bcc2d..000000000 --- a/4-projects/business_unit_2/nonproduction/README.md +++ /dev/null @@ -1,37 +0,0 @@ - -## Inputs - -| Name | Description | Type | Default | Required | -|------|-------------|------|---------|:--------:| -| instance\_region | Region which the peered subnet will be created (Should be same region as the VM that will be created on step 5-app-infra on the peering project). | `string` | `"us-central1"` | no | -| location\_gcs | Case-Sensitive Location for GCS Bucket (Should be same region as the KMS Keyring) | `string` | `"US"` | no | -| location\_kms | Case-Sensitive Location for KMS Keyring (Should be same region as the GCS Bucket) | `string` | `"us"` | no | -| peering\_module\_depends\_on | List of modules or resources peering module depends on. | `list(any)` | `[]` | no | -| remote\_state\_bucket | Backend bucket to load Terraform Remote State Data from previous steps. | `string` | n/a | yes | -| tfc\_org\_name | Name of the TFC organization | `string` | `""` | no | - -## Outputs - -| Name | Description | -|------|-------------| -| access\_context\_manager\_policy\_id | Access Context Manager Policy ID. | -| base\_shared\_vpc\_project | Project sample base project. | -| base\_shared\_vpc\_project\_sa | Project sample base project SA. | -| base\_subnets\_self\_links | The self-links of subnets from base environment. | -| bucket | The created storage bucket. | -| env\_kms\_project | Project sample for KMS usage project ID. | -| floating\_project | Project sample floating project. | -| iap\_firewall\_tags | The security tags created for IAP (SSH and RDP) firewall rules and to be used on the VM created on step 5-app-infra on the peering network project. | -| keyring | The name of the keyring. | -| keys | List of created key names. | -| peering\_complete | Output to be used as a module dependency. | -| peering\_network | Peer network peering resource. | -| peering\_project | Project sample peering project id. | -| peering\_subnetwork\_self\_link | The subnetwork self link of the peering network. | -| restricted\_enabled\_apis | Activated APIs. | -| restricted\_shared\_vpc\_project | Project sample restricted project id. | -| restricted\_shared\_vpc\_project\_number | Project sample restricted project. | -| restricted\_subnets\_self\_links | The self-links of subnets from restricted environment. | -| vpc\_service\_control\_perimeter\_name | VPC Service Control name. | - - diff --git a/4-projects/business_unit_2/nonproduction/backend.tf b/4-projects/business_unit_2/nonproduction/backend.tf deleted file mode 100644 index 8d75824f7..000000000 --- a/4-projects/business_unit_2/nonproduction/backend.tf +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright 2021 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. - */ - -terraform { - backend "gcs" { - bucket = "UPDATE_PROJECTS_BACKEND" - prefix = "terraform/projects/business_unit_2/nonproduction" - } -} diff --git a/4-projects/business_unit_2/nonproduction/backend.tf.cloud.example b/4-projects/business_unit_2/nonproduction/backend.tf.cloud.example deleted file mode 100644 index f6921e66f..000000000 --- a/4-projects/business_unit_2/nonproduction/backend.tf.cloud.example +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright 2023 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. - */ - -terraform { - cloud { - workspaces { - name = "4-bu2-nonproduction" - } - } -} diff --git a/4-projects/business_unit_2/nonproduction/common.auto.tfvars b/4-projects/business_unit_2/nonproduction/common.auto.tfvars deleted file mode 120000 index 39aaa4621..000000000 --- a/4-projects/business_unit_2/nonproduction/common.auto.tfvars +++ /dev/null @@ -1 +0,0 @@ -../../common.auto.tfvars \ No newline at end of file diff --git a/4-projects/business_unit_2/nonproduction/main.tf b/4-projects/business_unit_2/nonproduction/main.tf deleted file mode 100644 index ab1570069..000000000 --- a/4-projects/business_unit_2/nonproduction/main.tf +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright 2022 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. - */ - -module "env" { - source = "../../modules/base_env" - - env = "nonproduction" - business_code = "bu2" - business_unit = "business_unit_2" - remote_state_bucket = var.remote_state_bucket - location_kms = var.location_kms - location_gcs = var.location_gcs - tfc_org_name = var.tfc_org_name - peering_module_depends_on = var.peering_module_depends_on - peering_iap_fw_rules_enabled = true - subnet_region = var.instance_region - subnet_ip_range = "10.4.128.0/21" -} diff --git a/4-projects/business_unit_2/nonproduction/nonproduction.auto.tfvars b/4-projects/business_unit_2/nonproduction/nonproduction.auto.tfvars deleted file mode 120000 index 360077be2..000000000 --- a/4-projects/business_unit_2/nonproduction/nonproduction.auto.tfvars +++ /dev/null @@ -1 +0,0 @@ -../../nonproduction.auto.example.tfvars \ No newline at end of file diff --git a/4-projects/business_unit_2/nonproduction/outputs.tf b/4-projects/business_unit_2/nonproduction/outputs.tf deleted file mode 100644 index 6f07af601..000000000 --- a/4-projects/business_unit_2/nonproduction/outputs.tf +++ /dev/null @@ -1,110 +0,0 @@ -/** - * Copyright 2021 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. - */ - -output "base_shared_vpc_project" { - description = "Project sample base project." - value = module.env.base_shared_vpc_project -} - -output "base_shared_vpc_project_sa" { - description = "Project sample base project SA." - value = module.env.base_shared_vpc_project_sa -} - -output "base_subnets_self_links" { - value = module.env.base_subnets_self_links - description = "The self-links of subnets from base environment." -} - -output "floating_project" { - description = "Project sample floating project." - value = module.env.floating_project -} - -output "peering_project" { - description = "Project sample peering project id." - value = module.env.peering_project -} - -output "peering_network" { - description = "Peer network peering resource." - value = module.env.peering_network -} - -output "restricted_shared_vpc_project" { - description = "Project sample restricted project id." - value = module.env.restricted_shared_vpc_project -} - -output "restricted_shared_vpc_project_number" { - description = "Project sample restricted project." - value = module.env.restricted_shared_vpc_project_number -} - -output "restricted_subnets_self_links" { - value = module.env.restricted_subnets_self_links - description = "The self-links of subnets from restricted environment." -} - -output "vpc_service_control_perimeter_name" { - description = "VPC Service Control name." - value = module.env.vpc_service_control_perimeter_name -} - -output "restricted_enabled_apis" { - description = "Activated APIs." - value = module.env.restricted_enabled_apis -} - -output "access_context_manager_policy_id" { - description = "Access Context Manager Policy ID." - value = module.env.access_context_manager_policy_id -} - -output "peering_complete" { - description = "Output to be used as a module dependency." - value = module.env.peering_complete -} - -output "env_kms_project" { - description = "Project sample for KMS usage project ID." - value = module.env.env_kms_project -} - -output "keyring" { - description = "The name of the keyring." - value = module.env.keyring -} - -output "keys" { - description = "List of created key names." - value = module.env.keys -} - -output "bucket" { - description = "The created storage bucket." - value = module.env.bucket -} - -output "peering_subnetwork_self_link" { - description = "The subnetwork self link of the peering network." - value = module.env.peering_subnetwork_self_link -} - -output "iap_firewall_tags" { - description = "The security tags created for IAP (SSH and RDP) firewall rules and to be used on the VM created on step 5-app-infra on the peering network project." - value = module.env.iap_firewall_tags -} diff --git a/4-projects/business_unit_2/nonproduction/variables.tf b/4-projects/business_unit_2/nonproduction/variables.tf deleted file mode 100644 index 2cb800af8..000000000 --- a/4-projects/business_unit_2/nonproduction/variables.tf +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Copyright 2021 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. - */ - -variable "remote_state_bucket" { - description = "Backend bucket to load Terraform Remote State Data from previous steps." - type = string -} - -variable "location_kms" { - description = "Case-Sensitive Location for KMS Keyring (Should be same region as the GCS Bucket)" - type = string - default = "us" -} - -variable "location_gcs" { - description = "Case-Sensitive Location for GCS Bucket (Should be same region as the KMS Keyring)" - type = string - default = "US" -} - -variable "peering_module_depends_on" { - description = "List of modules or resources peering module depends on." - type = list(any) - default = [] -} - -variable "tfc_org_name" { - description = "Name of the TFC organization" - type = string - default = "" -} - -variable "instance_region" { - description = "Region which the peered subnet will be created (Should be same region as the VM that will be created on step 5-app-infra on the peering project)." - type = string - default = "us-central1" -} diff --git a/4-projects/business_unit_2/production/README.md b/4-projects/business_unit_2/production/README.md deleted file mode 100644 index bb68bcc2d..000000000 --- a/4-projects/business_unit_2/production/README.md +++ /dev/null @@ -1,37 +0,0 @@ - -## Inputs - -| Name | Description | Type | Default | Required | -|------|-------------|------|---------|:--------:| -| instance\_region | Region which the peered subnet will be created (Should be same region as the VM that will be created on step 5-app-infra on the peering project). | `string` | `"us-central1"` | no | -| location\_gcs | Case-Sensitive Location for GCS Bucket (Should be same region as the KMS Keyring) | `string` | `"US"` | no | -| location\_kms | Case-Sensitive Location for KMS Keyring (Should be same region as the GCS Bucket) | `string` | `"us"` | no | -| peering\_module\_depends\_on | List of modules or resources peering module depends on. | `list(any)` | `[]` | no | -| remote\_state\_bucket | Backend bucket to load Terraform Remote State Data from previous steps. | `string` | n/a | yes | -| tfc\_org\_name | Name of the TFC organization | `string` | `""` | no | - -## Outputs - -| Name | Description | -|------|-------------| -| access\_context\_manager\_policy\_id | Access Context Manager Policy ID. | -| base\_shared\_vpc\_project | Project sample base project. | -| base\_shared\_vpc\_project\_sa | Project sample base project SA. | -| base\_subnets\_self\_links | The self-links of subnets from base environment. | -| bucket | The created storage bucket. | -| env\_kms\_project | Project sample for KMS usage project ID. | -| floating\_project | Project sample floating project. | -| iap\_firewall\_tags | The security tags created for IAP (SSH and RDP) firewall rules and to be used on the VM created on step 5-app-infra on the peering network project. | -| keyring | The name of the keyring. | -| keys | List of created key names. | -| peering\_complete | Output to be used as a module dependency. | -| peering\_network | Peer network peering resource. | -| peering\_project | Project sample peering project id. | -| peering\_subnetwork\_self\_link | The subnetwork self link of the peering network. | -| restricted\_enabled\_apis | Activated APIs. | -| restricted\_shared\_vpc\_project | Project sample restricted project id. | -| restricted\_shared\_vpc\_project\_number | Project sample restricted project. | -| restricted\_subnets\_self\_links | The self-links of subnets from restricted environment. | -| vpc\_service\_control\_perimeter\_name | VPC Service Control name. | - - diff --git a/4-projects/business_unit_2/production/backend.tf b/4-projects/business_unit_2/production/backend.tf deleted file mode 100644 index 29515ef83..000000000 --- a/4-projects/business_unit_2/production/backend.tf +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright 2021 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. - */ - -terraform { - backend "gcs" { - bucket = "UPDATE_PROJECTS_BACKEND" - prefix = "terraform/projects/business_unit_2/production" - } -} diff --git a/4-projects/business_unit_2/production/backend.tf.cloud.example b/4-projects/business_unit_2/production/backend.tf.cloud.example deleted file mode 100644 index e182845e6..000000000 --- a/4-projects/business_unit_2/production/backend.tf.cloud.example +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright 2023 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. - */ - -terraform { - cloud { - workspaces { - name = "4-bu2-production" - } - } -} diff --git a/4-projects/business_unit_2/production/common.auto.tfvars b/4-projects/business_unit_2/production/common.auto.tfvars deleted file mode 120000 index 39aaa4621..000000000 --- a/4-projects/business_unit_2/production/common.auto.tfvars +++ /dev/null @@ -1 +0,0 @@ -../../common.auto.tfvars \ No newline at end of file diff --git a/4-projects/business_unit_2/production/main.tf b/4-projects/business_unit_2/production/main.tf deleted file mode 100644 index c0e5fc299..000000000 --- a/4-projects/business_unit_2/production/main.tf +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright 2022 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. - */ - -module "env" { - source = "../../modules/base_env" - - env = "production" - business_code = "bu2" - business_unit = "business_unit_2" - remote_state_bucket = var.remote_state_bucket - location_kms = var.location_kms - location_gcs = var.location_gcs - tfc_org_name = var.tfc_org_name - peering_module_depends_on = var.peering_module_depends_on - peering_iap_fw_rules_enabled = true - subnet_region = var.instance_region - subnet_ip_range = "10.4.192.0/21" -} diff --git a/4-projects/business_unit_2/production/outputs.tf b/4-projects/business_unit_2/production/outputs.tf deleted file mode 100644 index 6f07af601..000000000 --- a/4-projects/business_unit_2/production/outputs.tf +++ /dev/null @@ -1,110 +0,0 @@ -/** - * Copyright 2021 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. - */ - -output "base_shared_vpc_project" { - description = "Project sample base project." - value = module.env.base_shared_vpc_project -} - -output "base_shared_vpc_project_sa" { - description = "Project sample base project SA." - value = module.env.base_shared_vpc_project_sa -} - -output "base_subnets_self_links" { - value = module.env.base_subnets_self_links - description = "The self-links of subnets from base environment." -} - -output "floating_project" { - description = "Project sample floating project." - value = module.env.floating_project -} - -output "peering_project" { - description = "Project sample peering project id." - value = module.env.peering_project -} - -output "peering_network" { - description = "Peer network peering resource." - value = module.env.peering_network -} - -output "restricted_shared_vpc_project" { - description = "Project sample restricted project id." - value = module.env.restricted_shared_vpc_project -} - -output "restricted_shared_vpc_project_number" { - description = "Project sample restricted project." - value = module.env.restricted_shared_vpc_project_number -} - -output "restricted_subnets_self_links" { - value = module.env.restricted_subnets_self_links - description = "The self-links of subnets from restricted environment." -} - -output "vpc_service_control_perimeter_name" { - description = "VPC Service Control name." - value = module.env.vpc_service_control_perimeter_name -} - -output "restricted_enabled_apis" { - description = "Activated APIs." - value = module.env.restricted_enabled_apis -} - -output "access_context_manager_policy_id" { - description = "Access Context Manager Policy ID." - value = module.env.access_context_manager_policy_id -} - -output "peering_complete" { - description = "Output to be used as a module dependency." - value = module.env.peering_complete -} - -output "env_kms_project" { - description = "Project sample for KMS usage project ID." - value = module.env.env_kms_project -} - -output "keyring" { - description = "The name of the keyring." - value = module.env.keyring -} - -output "keys" { - description = "List of created key names." - value = module.env.keys -} - -output "bucket" { - description = "The created storage bucket." - value = module.env.bucket -} - -output "peering_subnetwork_self_link" { - description = "The subnetwork self link of the peering network." - value = module.env.peering_subnetwork_self_link -} - -output "iap_firewall_tags" { - description = "The security tags created for IAP (SSH and RDP) firewall rules and to be used on the VM created on step 5-app-infra on the peering network project." - value = module.env.iap_firewall_tags -} diff --git a/4-projects/business_unit_2/production/production.auto.tfvars b/4-projects/business_unit_2/production/production.auto.tfvars deleted file mode 120000 index be31a2edd..000000000 --- a/4-projects/business_unit_2/production/production.auto.tfvars +++ /dev/null @@ -1 +0,0 @@ -../../production.auto.tfvars \ No newline at end of file diff --git a/4-projects/business_unit_2/production/variables.tf b/4-projects/business_unit_2/production/variables.tf deleted file mode 100644 index 2cb800af8..000000000 --- a/4-projects/business_unit_2/production/variables.tf +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Copyright 2021 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. - */ - -variable "remote_state_bucket" { - description = "Backend bucket to load Terraform Remote State Data from previous steps." - type = string -} - -variable "location_kms" { - description = "Case-Sensitive Location for KMS Keyring (Should be same region as the GCS Bucket)" - type = string - default = "us" -} - -variable "location_gcs" { - description = "Case-Sensitive Location for GCS Bucket (Should be same region as the KMS Keyring)" - type = string - default = "US" -} - -variable "peering_module_depends_on" { - description = "List of modules or resources peering module depends on." - type = list(any) - default = [] -} - -variable "tfc_org_name" { - description = "Name of the TFC organization" - type = string - default = "" -} - -variable "instance_region" { - description = "Region which the peered subnet will be created (Should be same region as the VM that will be created on step 5-app-infra on the peering project)." - type = string - default = "us-central1" -} diff --git a/4-projects/business_unit_2/shared/README.md b/4-projects/business_unit_2/shared/README.md deleted file mode 100644 index 9515329eb..000000000 --- a/4-projects/business_unit_2/shared/README.md +++ /dev/null @@ -1,26 +0,0 @@ - -## Inputs - -| Name | Description | Type | Default | Required | -|------|-------------|------|---------|:--------:| -| default\_region | Default region to create resources where applicable. | `string` | `"us-central1"` | no | -| project\_budget | Budget configuration.
budget\_amount: The amount to use as the budget.
alert\_spent\_percents: A list of percentages of the budget to alert on when threshold is exceeded.
alert\_pubsub\_topic: The name of the Cloud Pub/Sub topic where budget related messages will be published, in the form of `projects/{project_id}/topics/{topic_id}`.
alert\_spend\_basis: The type of basis used to determine if spend has passed the threshold. Possible choices are `CURRENT_SPEND` or `FORECASTED_SPEND` (default). |
object({
budget_amount = optional(number, 1000)
alert_spent_percents = optional(list(number), [1.2])
alert_pubsub_topic = optional(string, null)
alert_spend_basis = optional(string, "FORECASTED_SPEND")
})
| `{}` | no | -| remote\_state\_bucket | Backend bucket to load Terraform Remote State Data from previous steps. | `string` | n/a | yes | -| tfc\_org\_name | Name of the TFC organization | `string` | `""` | no | - -## Outputs - -| Name | Description | -|------|-------------| -| apply\_triggers\_id | CB apply triggers | -| artifact\_buckets | GCS Buckets to store Cloud Build Artifacts | -| cloudbuild\_project\_id | n/a | -| default\_region | Default region to create resources where applicable. | -| enable\_cloudbuild\_deploy | Enable infra deployment using Cloud Build. | -| log\_buckets | GCS Buckets to store Cloud Build logs | -| plan\_triggers\_id | CB plan triggers | -| repos | CSRs to store source code | -| state\_buckets | GCS Buckets to store TF state | -| terraform\_service\_accounts | APP Infra Pipeline Terraform Accounts. | - - diff --git a/4-projects/business_unit_2/shared/backend.tf b/4-projects/business_unit_2/shared/backend.tf deleted file mode 100644 index 42d41b40c..000000000 --- a/4-projects/business_unit_2/shared/backend.tf +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright 2021 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. - */ - -terraform { - backend "gcs" { - bucket = "UPDATE_PROJECTS_BACKEND" - prefix = "terraform/projects/business_unit_2/shared" - } -} diff --git a/4-projects/business_unit_2/shared/backend.tf.cloud.example b/4-projects/business_unit_2/shared/backend.tf.cloud.example deleted file mode 100644 index 5dfb05be0..000000000 --- a/4-projects/business_unit_2/shared/backend.tf.cloud.example +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright 2023 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. - */ - -terraform { - cloud { - workspaces { - name = "4-bu2-shared" - } - } -} diff --git a/4-projects/business_unit_2/shared/common.auto.tfvars b/4-projects/business_unit_2/shared/common.auto.tfvars deleted file mode 120000 index 39aaa4621..000000000 --- a/4-projects/business_unit_2/shared/common.auto.tfvars +++ /dev/null @@ -1 +0,0 @@ -../../common.auto.tfvars \ No newline at end of file diff --git a/4-projects/business_unit_2/shared/example_infra_pipeline.tf b/4-projects/business_unit_2/shared/example_infra_pipeline.tf deleted file mode 100644 index 6bc339edd..000000000 --- a/4-projects/business_unit_2/shared/example_infra_pipeline.tf +++ /dev/null @@ -1,71 +0,0 @@ -/** - * Copyright 2021 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. - */ - -locals { - repo_names = ["bu2-example-app"] -} - -module "app_infra_cloudbuild_project" { - source = "../../modules/single_project" - count = local.enable_cloudbuild_deploy ? 1 : 0 - - org_id = local.org_id - billing_account = local.billing_account - folder_id = local.common_folder_name - environment = "common" - project_budget = var.project_budget - project_prefix = local.project_prefix - activate_apis = [ - "cloudbuild.googleapis.com", - "sourcerepo.googleapis.com", - "cloudkms.googleapis.com", - "iam.googleapis.com", - "artifactregistry.googleapis.com", - "cloudresourcemanager.googleapis.com" - ] - # Metadata - project_suffix = "infra-pipeline" - application_name = "app-infra-pipelines" - billing_code = "1234" - primary_contact = "example@example.com" - secondary_contact = "example2@example.com" - business_code = "bu2" -} - -module "infra_pipelines" { - source = "../../modules/infra_pipelines" - count = local.enable_cloudbuild_deploy ? 1 : 0 - - org_id = local.org_id - cloudbuild_project_id = module.app_infra_cloudbuild_project[0].project_id - cloud_builder_artifact_repo = local.cloud_builder_artifact_repo - remote_tfstate_bucket = local.projects_remote_bucket_tfstate - billing_account = local.billing_account - default_region = var.default_region - app_infra_repos = local.repo_names - private_worker_pool_id = local.cloud_build_private_worker_pool_id -} - -/** - * When Jenkins CICD is used for deployment this resource - * is created to terraform validation works. - * Without this resource, this module creates zero resources - * and it breaks terraform validation throwing the error below: - * ERROR: [Terraform plan json does not contain resource_changes key] - */ -resource "null_resource" "jenkins_cicd" { - count = !local.enable_cloudbuild_deploy ? 1 : 0 -} diff --git a/4-projects/business_unit_2/shared/outputs.tf b/4-projects/business_unit_2/shared/outputs.tf deleted file mode 100644 index 5c3a84874..000000000 --- a/4-projects/business_unit_2/shared/outputs.tf +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Copyright 2021 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. - */ - -output "default_region" { - description = "Default region to create resources where applicable." - value = try(module.infra_pipelines[0].default_region, "") -} - -output "cloudbuild_project_id" { - value = try(module.app_infra_cloudbuild_project[0].project_id, "") -} - -output "terraform_service_accounts" { - description = "APP Infra Pipeline Terraform Accounts." - value = try(module.infra_pipelines[0].terraform_service_accounts, {}) -} - -output "repos" { - description = "CSRs to store source code" - value = try(module.infra_pipelines[0].repos, toset([])) -} - -output "artifact_buckets" { - description = "GCS Buckets to store Cloud Build Artifacts" - value = try(module.infra_pipelines[0].artifact_buckets, {}) -} - -output "state_buckets" { - description = "GCS Buckets to store TF state" - value = try(module.infra_pipelines[0].state_buckets, {}) -} - -output "log_buckets" { - description = "GCS Buckets to store Cloud Build logs" - value = try(module.infra_pipelines[0].log_buckets, {}) -} - -output "plan_triggers_id" { - description = "CB plan triggers" - value = try(module.infra_pipelines[0].plan_triggers_id, []) -} - -output "apply_triggers_id" { - description = "CB apply triggers" - value = try(module.infra_pipelines[0].apply_triggers_id, []) -} - -output "enable_cloudbuild_deploy" { - description = "Enable infra deployment using Cloud Build." - value = local.enable_cloudbuild_deploy -} diff --git a/4-projects/business_unit_2/shared/remote.tf b/4-projects/business_unit_2/shared/remote.tf deleted file mode 100644 index 2597f19ba..000000000 --- a/4-projects/business_unit_2/shared/remote.tf +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright 2022 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. - */ - -locals { - org_id = data.terraform_remote_state.bootstrap.outputs.common_config.org_id - parent_folder = data.terraform_remote_state.bootstrap.outputs.common_config.parent_folder - parent = data.terraform_remote_state.bootstrap.outputs.common_config.parent_id - billing_account = data.terraform_remote_state.bootstrap.outputs.common_config.billing_account - common_folder_name = data.terraform_remote_state.org.outputs.common_folder_name - default_region = data.terraform_remote_state.bootstrap.outputs.common_config.default_region - project_prefix = data.terraform_remote_state.bootstrap.outputs.common_config.project_prefix - folder_prefix = data.terraform_remote_state.bootstrap.outputs.common_config.folder_prefix - projects_remote_bucket_tfstate = data.terraform_remote_state.bootstrap.outputs.projects_gcs_bucket_tfstate - cloud_build_private_worker_pool_id = try(data.terraform_remote_state.bootstrap.outputs.cloud_build_private_worker_pool_id, "") - cloud_builder_artifact_repo = try(data.terraform_remote_state.bootstrap.outputs.cloud_builder_artifact_repo, "") - enable_cloudbuild_deploy = local.cloud_builder_artifact_repo != "" -} - -data "terraform_remote_state" "bootstrap" { - backend = "gcs" - - config = { - bucket = var.remote_state_bucket - prefix = "terraform/bootstrap/state" - } -} - -data "terraform_remote_state" "org" { - backend = "gcs" - - config = { - bucket = var.remote_state_bucket - prefix = "terraform/org/state" - } -} diff --git a/4-projects/business_unit_2/shared/remote.tf.cloud.example b/4-projects/business_unit_2/shared/remote.tf.cloud.example deleted file mode 100644 index 525ba30af..000000000 --- a/4-projects/business_unit_2/shared/remote.tf.cloud.example +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright 2023 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. - */ - -locals { - org_id = data.tfe_outputs.bootstrap.nonsensitive_values.common_config.org_id - parent_folder = data.tfe_outputs.bootstrap.nonsensitive_values.common_config.parent_folder - parent = data.tfe_outputs.bootstrap.nonsensitive_values.common_config.parent_id - billing_account = data.tfe_outputs.bootstrap.nonsensitive_values.common_config.billing_account - common_folder_name = data.tfe_outputs.org.nonsensitive_values.common_folder_name - default_region = data.tfe_outputs.bootstrap.nonsensitive_values.common_config.default_region - project_prefix = data.tfe_outputs.bootstrap.nonsensitive_values.common_config.project_prefix - folder_prefix = data.tfe_outputs.bootstrap.nonsensitive_values.common_config.folder_prefix - projects_remote_bucket_tfstate = "" - cloud_build_private_worker_pool_id = try(data.tfe_outputs.bootstrap.nonsensitive_values.cloud_build_private_worker_pool_id, "") - cloud_builder_artifact_repo = try(data.tfe_outputs.bootstrap.nonsensitive_values.cloud_builder_artifact_repo, "") - enable_cloudbuild_deploy = local.cloud_builder_artifact_repo != "" -} - -data "tfe_outputs" "bootstrap" { - organization = var.tfc_org_name - workspace = "0-shared" -} - -data "tfe_outputs" "org" { - organization = var.tfc_org_name - workspace = "1-shared" -} diff --git a/4-projects/business_unit_2/shared/shared.auto.tfvars b/4-projects/business_unit_2/shared/shared.auto.tfvars deleted file mode 120000 index b7f8387a8..000000000 --- a/4-projects/business_unit_2/shared/shared.auto.tfvars +++ /dev/null @@ -1 +0,0 @@ -../../shared.auto.tfvars \ No newline at end of file diff --git a/4-projects/business_unit_2/shared/variables.tf b/4-projects/business_unit_2/shared/variables.tf deleted file mode 100644 index 5f08bcddf..000000000 --- a/4-projects/business_unit_2/shared/variables.tf +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Copyright 2021 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. - */ - -variable "default_region" { - description = "Default region to create resources where applicable." - type = string - default = "us-central1" -} - -variable "project_budget" { - description = < Date: Fri, 17 May 2024 15:16:38 +0000 Subject: [PATCH 2/2] Removed additional instances of bu2, business_unit_2 in test and script files --- helpers/foundation-deployer/stages/apply.go | 2 +- helpers/foundation-deployer/stages/destroy.go | 8 +++---- test/disable_tf_files.sh | 8 ------- .../projects-shared/projects_shared_test.go | 5 ---- test/integration/projects/projects_test.go | 23 +------------------ test/restore_tf_files.sh | 20 ---------------- 6 files changed, 6 insertions(+), 60 deletions(-) diff --git a/helpers/foundation-deployer/stages/apply.go b/helpers/foundation-deployer/stages/apply.go index 741464f3f..243473fde 100644 --- a/helpers/foundation-deployer/stages/apply.go +++ b/helpers/foundation-deployer/stages/apply.go @@ -359,7 +359,7 @@ func DeployProjectsStage(t testing.TB, s steps.Steps, tfvars GlobalTFVars, outpu Repo: ProjectsRepo, GitConf: conf, HasManualStep: true, - GroupingUnits: []string{"business_unit_1", "business_unit_2"}, + GroupingUnits: []string{"business_unit_1"}, Envs: []string{"production", "nonproduction", "development"}, } diff --git a/helpers/foundation-deployer/stages/destroy.go b/helpers/foundation-deployer/stages/destroy.go index 7aacf3c9c..392a2f24a 100644 --- a/helpers/foundation-deployer/stages/destroy.go +++ b/helpers/foundation-deployer/stages/destroy.go @@ -135,7 +135,7 @@ func DestroyProjectsStage(t testing.TB, s steps.Steps, outputs BootstrapOutputs, Step: ProjectsStep, Repo: ProjectsRepo, HasManualStep: true, - GroupingUnits: []string{"business_unit_1", "business_unit_2"}, + GroupingUnits: []string{"business_unit_1"}, Envs: []string{"development", "nonproduction", "production"}, } return destroyStage(t, stageConf, s, c) @@ -194,9 +194,9 @@ func destroyStage(t testing.TB, sc StageConf, s steps.Steps, c CommonConf) error for _, g := range groupingUnits { err := s.RunDestroyStep(fmt.Sprintf("%s.%s.apply-shared", sc.Repo, g), func() error { options := &terraform.Options{ - TerraformDir: filepath.Join(gcpPath, g, "shared"), - Logger: c.Logger, - NoColor: true, + TerraformDir: filepath.Join(gcpPath, g, "shared"), + Logger: c.Logger, + NoColor: true, RetryableTerraformErrors: testutils.RetryableTransientErrors, MaxRetries: 2, TimeBetweenRetries: 2 * time.Minute, diff --git a/test/disable_tf_files.sh b/test/disable_tf_files.sh index ee9dc41bc..6b2743493 100755 --- a/test/disable_tf_files.sh +++ b/test/disable_tf_files.sh @@ -57,29 +57,21 @@ function shared(){ function projectsshared(){ # disable shared.auto.tfvars mv 4-projects/business_unit_1/shared/shared.auto.tfvars 4-projects/business_unit_1/shared/shared.auto.tfvars.disabled - mv 4-projects/business_unit_2/shared/shared.auto.tfvars 4-projects/business_unit_2/shared/shared.auto.tfvars.disabled # disable common.auto.tfvars mv 4-projects/business_unit_1/shared/common.auto.tfvars 4-projects/business_unit_1/shared/common.auto.tfvars.disabled - mv 4-projects/business_unit_2/shared/common.auto.tfvars 4-projects/business_unit_2/shared/common.auto.tfvars.disabled } function projects(){ # disable ENVS.auto.tfvars in main module mv 4-projects/business_unit_1/development/development.auto.tfvars 4-projects/business_unit_1/development/development.auto.tfvars.disabled - mv 4-projects/business_unit_2/development/development.auto.tfvars 4-projects/business_unit_2/development/development.auto.tfvars.disabled mv 4-projects/business_unit_1/nonproduction/nonproduction.auto.tfvars 4-projects/business_unit_1/nonproduction/nonproduction.auto.tfvars.disabled - mv 4-projects/business_unit_2/nonproduction/nonproduction.auto.tfvars 4-projects/business_unit_2/nonproduction/nonproduction.auto.tfvars.disabled mv 4-projects/business_unit_1/production/production.auto.tfvars 4-projects/business_unit_1/production/production.auto.tfvars.disabled - mv 4-projects/business_unit_2/production/production.auto.tfvars 4-projects/business_unit_2/production/production.auto.tfvars.disabled # disable common.auto.tfvars in main module mv 4-projects/business_unit_1/development/common.auto.tfvars 4-projects/business_unit_1/development/common.auto.tfvars.disabled mv 4-projects/business_unit_1/nonproduction/common.auto.tfvars 4-projects/business_unit_1/nonproduction/common.auto.tfvars.disabled mv 4-projects/business_unit_1/production/common.auto.tfvars 4-projects/business_unit_1/production/common.auto.tfvars.disabled - mv 4-projects/business_unit_2/development/common.auto.tfvars 4-projects/business_unit_2/development/common.auto.tfvars.disabled - mv 4-projects/business_unit_2/nonproduction/common.auto.tfvars 4-projects/business_unit_2/nonproduction/common.auto.tfvars.disabled - mv 4-projects/business_unit_2/production/common.auto.tfvars 4-projects/business_unit_2/production/common.auto.tfvars.disabled } function appinfra(){ diff --git a/test/integration/projects-shared/projects_shared_test.go b/test/integration/projects-shared/projects_shared_test.go index e7f295d33..71c14681d 100644 --- a/test/integration/projects-shared/projects_shared_test.go +++ b/test/integration/projects-shared/projects_shared_test.go @@ -60,11 +60,6 @@ func TestProjectsShared(t *testing.T) { repo: "bu1-example-app", tfDir: "../../../4-projects/business_unit_1/shared", }, - { - name: "bu2", - repo: "bu2-example-app", - tfDir: "../../../4-projects/business_unit_2/shared", - }, } { tts := tts t.Run(tts.name, func(t *testing.T) { diff --git a/test/integration/projects/projects_test.go b/test/integration/projects/projects_test.go index 46b3b8ec4..1fa7e298a 100644 --- a/test/integration/projects/projects_test.go +++ b/test/integration/projects/projects_test.go @@ -97,28 +97,7 @@ func TestProjects(t *testing.T) { baseDir: "../../../4-projects/business_unit_1/%s", baseNetwork: fmt.Sprintf("vpc-p-shared-base%s", networkMode), restrictedNetwork: fmt.Sprintf("vpc-p-shared-restricted%s", networkMode), - }, - { - name: "bu2_development", - repo: "bu2-example-app", - baseDir: "../../../4-projects/business_unit_2/%s", - baseNetwork: fmt.Sprintf("vpc-d-shared-base%s", networkMode), - restrictedNetwork: fmt.Sprintf("vpc-d-shared-restricted%s", networkMode), - }, - { - name: "bu2_nonproduction", - repo: "bu2-example-app", - baseDir: "../../../4-projects/business_unit_2/%s", - baseNetwork: fmt.Sprintf("vpc-n-shared-base%s", networkMode), - restrictedNetwork: fmt.Sprintf("vpc-n-shared-restricted%s", networkMode), - }, - { - name: "bu2_production", - repo: "bu2-example-app", - baseDir: "../../../4-projects/business_unit_2/%s", - baseNetwork: fmt.Sprintf("vpc-p-shared-base%s", networkMode), - restrictedNetwork: fmt.Sprintf("vpc-p-shared-restricted%s", networkMode), - }, + } } { tt := tt t.Run(tt.name, func(t *testing.T) { diff --git a/test/restore_tf_files.sh b/test/restore_tf_files.sh index 2f9df9634..4a71bfa9e 100644 --- a/test/restore_tf_files.sh +++ b/test/restore_tf_files.sh @@ -80,48 +80,28 @@ function projects(){ mv 4-projects/business_unit_1/nonproduction/backend.tf.disabled 4-projects/business_unit_1/nonproduction/backend.tf mv 4-projects/business_unit_1/production/backend.tf.disabled 4-projects/business_unit_1/production/backend.tf mv 4-projects/business_unit_1/shared/backend.tf.disabled 4-projects/business_unit_1/shared/backend.tf - mv 4-projects/business_unit_2/development/backend.tf.disabled 4-projects/business_unit_2/development/backend.tf - mv 4-projects/business_unit_2/nonproduction/backend.tf.disabled 4-projects/business_unit_2/nonproduction/backend.tf - mv 4-projects/business_unit_2/production/backend.tf.disabled 4-projects/business_unit_2/production/backend.tf - mv 4-projects/business_unit_2/shared/backend.tf.disabled 4-projects/business_unit_2/shared/backend.tf # restore access_context.auto.tfvars in main module mv 4-projects/business_unit_1/development/access_context.auto.tfvars.disabled 4-projects/business_unit_1/development/access_context.auto.tfvars mv 4-projects/business_unit_1/nonproduction/access_context.auto.tfvars.disabled 4-projects/business_unit_1/nonproduction/access_context.auto.tfvars mv 4-projects/business_unit_1/production/access_context.auto.tfvars.disabled 4-projects/business_unit_1/production/access_context.auto.tfvars - mv 4-projects/business_unit_2/development/access_context.auto.tfvars.disabled 4-projects/business_unit_2/development/access_context.auto.tfvars - mv 4-projects/business_unit_2/nonproduction/access_context.auto.tfvars.disabled 4-projects/business_unit_2/nonproduction/access_context.auto.tfvars - mv 4-projects/business_unit_2/production/access_context.auto.tfvars.disabled 4-projects/business_unit_2/production/access_context.auto.tfvars # restore business_unit_1.auto.tfvars in main module mv 4-projects/business_unit_1/development/business_unit_1.auto.tfvars.disabled 4-projects/business_unit_1/development/business_unit_1.auto.tfvars mv 4-projects/business_unit_1/nonproduction/business_unit_1.auto.tfvars.disabled 4-projects/business_unit_1/nonproduction/business_unit_1.auto.tfvars mv 4-projects/business_unit_1/production/business_unit_1.auto.tfvars.disabled 4-projects/business_unit_1/production/business_unit_1.auto.tfvars - # restore business_unit_2.auto.tfvars in main module - mv 4-projects/business_unit_2/development/business_unit_2.auto.tfvars.disabled 4-projects/business_unit_2/development/business_unit_2.auto.tfvars - mv 4-projects/business_unit_2/nonproduction/business_unit_2.auto.tfvars.disabled 4-projects/business_unit_2/nonproduction/business_unit_2.auto.tfvars - mv 4-projects/business_unit_2/production/business_unit_2.auto.tfvars.disabled 4-projects/business_unit_2/production/business_unit_2.auto.tfvars - # restore ENVS.auto.tfvars in main module mv 4-projects/business_unit_1/development/development.auto.tfvars.disabled 4-projects/business_unit_1/development/development.auto.tfvars - mv 4-projects/business_unit_2/development/development.auto.tfvars.disabled 4-projects/business_unit_2/development/development.auto.tfvars mv 4-projects/business_unit_1/nonproduction/nonproduction.auto.tfvars.disabled 4-projects/business_unit_1/nonproduction/nonproduction.auto.tfvars - mv 4-projects/business_unit_2/nonproduction/nonproduction.auto.tfvars.disabled 4-projects/business_unit_2/nonproduction/nonproduction.auto.tfvars mv 4-projects/business_unit_1/production/production.auto.tfvars.disabled 4-projects/business_unit_1/production/production.auto.tfvars - mv 4-projects/business_unit_2/production/production.auto.tfvars.disabled 4-projects/business_unit_2/production/production.auto.tfvars mv 4-projects/business_unit_1/shared/shared.auto.tfvars.disabled 4-projects/business_unit_1/shared/shared.auto.tfvars - mv 4-projects/business_unit_2/shared/shared.auto.tfvars.disabled 4-projects/business_unit_2/shared/shared.auto.tfvars # restore common.auto.tfvars in main module mv 4-projects/business_unit_1/development/common.auto.tfvars.disabled 4-projects/business_unit_1/development/common.auto.tfvars mv 4-projects/business_unit_1/nonproduction/common.auto.tfvars.disabled 4-projects/business_unit_1/nonproduction/common.auto.tfvars mv 4-projects/business_unit_1/production/common.auto.tfvars.disabled 4-projects/business_unit_1/production/common.auto.tfvars mv 4-projects/business_unit_1/shared/common.auto.tfvars.disabled 4-projects/business_unit_1/shared/common.auto.tfvars - mv 4-projects/business_unit_2/development/common.auto.tfvars.disabled 4-projects/business_unit_2/development/common.auto.tfvars - mv 4-projects/business_unit_2/nonproduction/common.auto.tfvars.disabled 4-projects/business_unit_2/nonproduction/common.auto.tfvars - mv 4-projects/business_unit_2/production/common.auto.tfvars.disabled 4-projects/business_unit_2/production/common.auto.tfvars - mv 4-projects/business_unit_2/shared/common.auto.tfvars.disabled 4-projects/business_unit_2/shared/common.auto.tfvars }