Skip to content

Commit 7f29131

Browse files
committed
chore: upgrade modules to terraform provider v6
1 parent 3e4302d commit 7f29131

File tree

35 files changed

+128
-21
lines changed

35 files changed

+128
-21
lines changed

0-bootstrap/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ Each step has instructions for this change.
361361
| default\_region\_2 | Secondary default region to create resources where applicable. | `string` | `"us-west1"` | no |
362362
| default\_region\_gcs | Case-Sensitive default region to create gcs resources where applicable. | `string` | `"US"` | no |
363363
| default\_region\_kms | Secondary default region to create kms resources where applicable. | `string` | `"us"` | no |
364+
| folder\_deletion\_protection | Prevent Terraform from destroying or recreating the folder. | `string` | `true` | no |
364365
| folder\_prefix | Name prefix to use for folders created. Should be the same in all steps. | `string` | `"fldr"` | no |
365366
| groups | Contain the details of the Groups to be created. | <pre>object({<br> create_required_groups = optional(bool, false)<br> create_optional_groups = optional(bool, false)<br> billing_project = optional(string, null)<br> required_groups = object({<br> group_org_admins = string<br> group_billing_admins = string<br> billing_data_users = string<br> audit_data_users = string<br> })<br> optional_groups = optional(object({<br> gcp_security_reviewer = optional(string, "")<br> gcp_network_viewer = optional(string, "")<br> gcp_scc_admin = optional(string, "")<br> gcp_global_secrets_admin = optional(string, "")<br> gcp_kms_admin = optional(string, "")<br> }), {})<br> })</pre> | n/a | yes |
366367
| initial\_group\_config | Define the group configuration when it is initialized. Valid values are: WITH\_INITIAL\_OWNER, EMPTY and INITIAL\_GROUP\_CONFIG\_UNSPECIFIED. | `string` | `"WITH_INITIAL_OWNER"` | no |

0-bootstrap/main.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ locals {
3535
}
3636

3737
resource "google_folder" "bootstrap" {
38-
display_name = "${var.folder_prefix}-bootstrap"
39-
parent = local.parent
38+
display_name = "${var.folder_prefix}-bootstrap"
39+
parent = local.parent
40+
deletion_protection = var.folder_deletion_protection
4041
}
4142

4243
module "seed_bootstrap" {

0-bootstrap/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ variable "project_deletion_policy" {
9696
default = "PREVENT"
9797
}
9898

99+
variable "folder_deletion_protection" {
100+
description = "Prevent Terraform from destroying or recreating the folder."
101+
type = string
102+
default = true
103+
}
104+
99105
/* ----------------------------------------
100106
Specific to Groups creation
101107
---------------------------------------- */

1-org/envs/shared/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
| enforce\_allowed\_worker\_pools | Whether to enforce the organization policy restriction on allowed worker pools for Cloud Build. | `bool` | `false` | no |
1313
| essential\_contacts\_domains\_to\_allow | The list of domains that email addresses added to Essential Contacts can have. | `list(string)` | n/a | yes |
1414
| essential\_contacts\_language | Essential Contacts preferred language for notifications, as a ISO 639-1 language code. See [Supported languages](https://cloud.google.com/resource-manager/docs/managing-notification-contacts#supported-languages) for a list of supported languages. | `string` | `"en"` | no |
15+
| folder\_deletion\_protection | Prevent Terraform from destroying or recreating the folder. | `string` | `true` | no |
1516
| gcp\_groups | Groups to grant specific roles in the Organization.<br> platform\_viewer: Google Workspace or Cloud Identity group that have the ability to view resource information across the Google Cloud organization.<br> security\_reviewer: Google Workspace or Cloud Identity group that members are part of the security team responsible for reviewing cloud security<br> network\_viewer: Google Workspace or Cloud Identity group that members are part of the networking team and review network configurations.<br> scc\_admin: Google Workspace or Cloud Identity group that can administer Security Command Center.<br> audit\_viewer: Google Workspace or Cloud Identity group that members are part of an audit team and view audit logs in the logging project.<br> global\_secrets\_admin: Google Workspace or Cloud Identity group that members are responsible for putting secrets into Secrets Manage | <pre>object({<br> audit_viewer = optional(string, null)<br> security_reviewer = optional(string, null)<br> network_viewer = optional(string, null)<br> scc_admin = optional(string, null)<br> global_secrets_admin = optional(string, null)<br> kms_admin = optional(string, null)<br> })</pre> | `{}` | no |
1617
| log\_export\_storage\_force\_destroy | (Optional) If set to true, delete all contents when destroying the resource; otherwise, destroying the resource will fail if contents are present. | `bool` | `false` | no |
1718
| log\_export\_storage\_location | The location of the storage bucket used to export logs. | `string` | `null` | no |

1-org/envs/shared/folders.tf

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@
1919
*****************************************/
2020

2121
resource "google_folder" "common" {
22-
display_name = "${local.folder_prefix}-common"
23-
parent = local.parent
22+
display_name = "${local.folder_prefix}-common"
23+
parent = local.parent
24+
deletion_protection = var.folder_deletion_protection
2425
}
2526

2627
resource "google_folder" "network" {
27-
display_name = "${local.folder_prefix}-network"
28-
parent = local.parent
28+
display_name = "${local.folder_prefix}-network"
29+
parent = local.parent
30+
deletion_protection = var.folder_deletion_protection
2931
}

1-org/envs/shared/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,3 +199,9 @@ variable "project_deletion_policy" {
199199
type = string
200200
default = "PREVENT"
201201
}
202+
203+
variable "folder_deletion_protection" {
204+
description = "Prevent Terraform from destroying or recreating the folder."
205+
type = string
206+
default = true
207+
}

2-environments/envs/development/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
| Name | Description | Type | Default | Required |
55
|------|-------------|------|---------|:--------:|
6+
| folder\_deletion\_protection | Prevent Terraform from destroying or recreating the folder. | `string` | `true` | no |
67
| project\_deletion\_policy | The deletion policy for the project created. | `string` | `"PREVENT"` | no |
78
| remote\_state\_bucket | Backend bucket to load Terraform Remote State Data from previous steps. | `string` | n/a | yes |
89
| tfc\_org\_name | Name of the TFC organization | `string` | `""` | no |

2-environments/envs/development/main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@ module "env" {
2222
remote_state_bucket = var.remote_state_bucket
2323
tfc_org_name = var.tfc_org_name
2424

25-
project_deletion_policy = var.project_deletion_policy
25+
project_deletion_policy = var.project_deletion_policy
26+
folder_deletion_protection = var.folder_deletion_protection
2627
}

2-environments/envs/development/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,9 @@ variable "project_deletion_policy" {
3030
type = string
3131
default = "PREVENT"
3232
}
33+
34+
variable "folder_deletion_protection" {
35+
description = "Prevent Terraform from destroying or recreating the folder."
36+
type = string
37+
default = true
38+
}

2-environments/envs/nonproduction/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
| Name | Description | Type | Default | Required |
55
|------|-------------|------|---------|:--------:|
6+
| folder\_deletion\_protection | Prevent Terraform from destroying or recreating the folder. | `string` | `true` | no |
67
| project\_deletion\_policy | The deletion policy for the project created. | `string` | `"PREVENT"` | no |
78
| remote\_state\_bucket | Backend bucket to load Terraform Remote State Data from previous steps. | `string` | n/a | yes |
89
| tfc\_org\_name | Name of the TFC organization | `string` | `""` | no |

2-environments/envs/nonproduction/main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@ module "env" {
2222
remote_state_bucket = var.remote_state_bucket
2323
tfc_org_name = var.tfc_org_name
2424

25-
project_deletion_policy = var.project_deletion_policy
25+
project_deletion_policy = var.project_deletion_policy
26+
folder_deletion_protection = var.folder_deletion_protection
2627
}

2-environments/envs/nonproduction/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,9 @@ variable "project_deletion_policy" {
3030
type = string
3131
default = "PREVENT"
3232
}
33+
34+
variable "folder_deletion_protection" {
35+
description = "Prevent Terraform from destroying or recreating the folder."
36+
type = string
37+
default = true
38+
}

2-environments/envs/production/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
| Name | Description | Type | Default | Required |
55
|------|-------------|------|---------|:--------:|
6+
| folder\_deletion\_protection | Prevent Terraform from destroying or recreating the folder. | `string` | `true` | no |
67
| project\_deletion\_policy | The deletion policy for the project created. | `string` | `"PREVENT"` | no |
78
| remote\_state\_bucket | Backend bucket to load Terraform Remote State Data from previous steps. | `string` | n/a | yes |
89
| tfc\_org\_name | Name of the TFC organization | `string` | `""` | no |

2-environments/envs/production/main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ module "env" {
2222
remote_state_bucket = var.remote_state_bucket
2323
tfc_org_name = var.tfc_org_name
2424

25-
project_deletion_policy = var.project_deletion_policy
25+
project_deletion_policy = var.project_deletion_policy
26+
folder_deletion_protection = var.folder_deletion_protection
2627

2728
assured_workload_configuration = {
2829
enabled = false

2-environments/envs/production/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,8 @@ variable "project_deletion_policy" {
3131
default = "PREVENT"
3232
}
3333

34+
variable "folder_deletion_protection" {
35+
description = "Prevent Terraform from destroying or recreating the folder."
36+
type = string
37+
default = true
38+
}

2-environments/modules/env_baseline/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
| assured\_workload\_configuration | Assured Workload configuration. See https://cloud.google.com/assured-workloads ."<br> enabled: If the assured workload should be created.<br> location: The location where the workload will be created.<br> display\_name: User-assigned resource display name.<br> compliance\_regime: Supported Compliance Regimes. See https://cloud.google.com/assured-workloads/docs/reference/rest/Shared.Types/ComplianceRegime .<br> resource\_type: The type of resource. One of CONSUMER\_FOLDER, KEYRING, or ENCRYPTION\_KEYS\_PROJECT. | <pre>object({<br> enabled = optional(bool, false)<br> location = optional(string, "us-central1")<br> display_name = optional(string, "FEDRAMP-MODERATE")<br> compliance_regime = optional(string, "FEDRAMP_MODERATE")<br> resource_type = optional(string, "CONSUMER_FOLDER")<br> })</pre> | `{}` | no |
77
| env | The environment to prepare (ex. development) | `string` | n/a | yes |
88
| environment\_code | A short form of the folder level resources (environment) within the Google Cloud organization (ex. d). | `string` | n/a | yes |
9+
| folder\_deletion\_protection | Prevent Terraform from destroying or recreating the folder. | `string` | `true` | no |
910
| project\_budget | Budget configuration for projects.<br> budget\_amount: The amount to use as the budget.<br> alert\_spent\_percents: A list of percentages of the budget to alert on when threshold is exceeded.<br> 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}`.<br> 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). | <pre>object({<br> base_network_budget_amount = optional(number, 1000)<br> base_network_alert_spent_percents = optional(list(number), [1.2])<br> base_network_alert_pubsub_topic = optional(string, null)<br> base_network_budget_alert_spend_basis = optional(string, "FORECASTED_SPEND")<br> restricted_network_budget_amount = optional(number, 1000)<br> restricted_network_alert_spent_percents = optional(list(number), [1.2])<br> restricted_network_alert_pubsub_topic = optional(string, null)<br> restricted_network_budget_alert_spend_basis = optional(string, "FORECASTED_SPEND")<br> secret_budget_amount = optional(number, 1000)<br> secret_alert_spent_percents = optional(list(number), [1.2])<br> secret_alert_pubsub_topic = optional(string, null)<br> secret_budget_alert_spend_basis = optional(string, "FORECASTED_SPEND")<br> kms_budget_amount = optional(number, 1000)<br> kms_alert_spent_percents = optional(list(number), [1.2])<br> kms_alert_pubsub_topic = optional(string, null)<br> kms_budget_alert_spend_basis = optional(string, "FORECASTED_SPEND")<br> })</pre> | `{}` | no |
1011
| project\_deletion\_policy | The deletion policy for the project created. | `string` | `"PREVENT"` | no |
1112
| remote\_state\_bucket | Backend bucket to load Terraform Remote State Data from previous steps. | `string` | n/a | yes |

2-environments/modules/env_baseline/folders.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@
1919
*****************************************/
2020

2121
resource "google_folder" "env" {
22-
display_name = "${local.folder_prefix}-${var.env}"
23-
parent = local.parent
22+
display_name = "${local.folder_prefix}-${var.env}"
23+
parent = local.parent
24+
deletion_protection = var.folder_deletion_protection
2425
}
2526

2627
resource "time_sleep" "wait_60_seconds" {

2-environments/modules/env_baseline/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,9 @@ variable "project_deletion_policy" {
8787
type = string
8888
default = "PREVENT"
8989
}
90+
91+
variable "folder_deletion_protection" {
92+
description = "Prevent Terraform from destroying or recreating the folder."
93+
type = string
94+
default = true
95+
}

4-projects/business_unit_1/development/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
| Name | Description | Type | Default | Required |
55
|------|-------------|------|---------|:--------:|
6+
| folder\_deletion\_protection | Prevent Terraform from destroying or recreating the folder. | `string` | `true` | no |
67
| gcs\_custom\_placement\_config | Configuration of the bucket's custom location in a dual-region bucket setup. If the bucket is designated a single or multi-region, the variable are null. | <pre>object({<br> data_locations = list(string)<br> })</pre> | `null` | no |
78
| 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` | `null` | no |
89
| location\_gcs | Case-Sensitive Location for GCS Bucket (Should be same region as the KMS Keyring) | `string` | `null` | no |

4-projects/business_unit_1/development/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,5 @@ module "env" {
3535
subnet_region = coalesce(var.instance_region, local.default_region)
3636
subnet_ip_range = "10.3.64.0/21"
3737
project_deletion_policy = var.project_deletion_policy
38+
folder_deletion_protection = var.folder_deletion_protection
3839
}

4-projects/business_unit_1/development/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,9 @@ variable "project_deletion_policy" {
6262
type = string
6363
default = "PREVENT"
6464
}
65+
66+
variable "folder_deletion_protection" {
67+
description = "Prevent Terraform from destroying or recreating the folder."
68+
type = string
69+
default = true
70+
}

4-projects/business_unit_1/nonproduction/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
| Name | Description | Type | Default | Required |
55
|------|-------------|------|---------|:--------:|
6+
| folder\_deletion\_protection | Prevent Terraform from destroying or recreating the folder. | `string` | `true` | no |
67
| gcs\_custom\_placement\_config | Configuration of the bucket's custom location in a dual-region bucket setup. If the bucket is designated a single or multi-region, the variable are null. | <pre>object({<br> data_locations = list(string)<br> })</pre> | `null` | no |
78
| 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` | `null` | no |
89
| location\_gcs | Case-Sensitive Location for GCS Bucket (Should be same region as the KMS Keyring) | `string` | `null` | no |

4-projects/business_unit_1/nonproduction/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,5 @@ module "env" {
3535
subnet_region = coalesce(var.instance_region, local.default_region)
3636
subnet_ip_range = "10.3.128.0/21"
3737
project_deletion_policy = var.project_deletion_policy
38+
folder_deletion_protection = var.folder_deletion_protection
3839
}

4-projects/business_unit_1/nonproduction/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,9 @@ variable "project_deletion_policy" {
6262
type = string
6363
default = "PREVENT"
6464
}
65+
66+
variable "folder_deletion_protection" {
67+
description = "Prevent Terraform from destroying or recreating the folder."
68+
type = string
69+
default = true
70+
}

4-projects/business_unit_1/production/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
| Name | Description | Type | Default | Required |
55
|------|-------------|------|---------|:--------:|
6+
| folder\_deletion\_protection | Prevent Terraform from destroying or recreating the folder. | `string` | `true` | no |
67
| gcs\_custom\_placement\_config | Configuration of the bucket's custom location in a dual-region bucket setup. If the bucket is designated a single or multi-region, the variable are null. | <pre>object({<br> data_locations = list(string)<br> })</pre> | `null` | no |
78
| 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` | `null` | no |
89
| location\_gcs | Case-Sensitive Location for GCS Bucket (Should be same region as the KMS Keyring) | `string` | `null` | no |

4-projects/business_unit_1/production/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,5 @@ module "env" {
3535
subnet_region = coalesce(var.instance_region, local.default_region)
3636
subnet_ip_range = "10.3.192.0/21"
3737
project_deletion_policy = var.project_deletion_policy
38+
folder_deletion_protection = var.folder_deletion_protection
3839
}

4-projects/business_unit_1/production/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,9 @@ variable "project_deletion_policy" {
6262
type = string
6363
default = "PREVENT"
6464
}
65+
66+
variable "folder_deletion_protection" {
67+
description = "Prevent Terraform from destroying or recreating the folder."
68+
type = string
69+
default = true
70+
}

4-projects/modules/base_env/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
| business\_unit | The business (ex. business\_unit\_1). | `string` | n/a | yes |
88
| env | The environment to prepare (ex. development). | `string` | n/a | yes |
99
| firewall\_enable\_logging | Toggle firewall logging for VPC Firewalls. | `bool` | `true` | no |
10+
| folder\_deletion\_protection | Prevent Terraform from destroying or recreating the folder. | `string` | `true` | no |
1011
| folder\_prefix | Name prefix to use for folders created. Should be the same in all steps. | `string` | `"fldr"` | no |
1112
| gcs\_bucket\_prefix | Name prefix to be used for GCS Bucket | `string` | `"bkt"` | no |
1213
| gcs\_custom\_placement\_config | Configuration of the bucket's custom location in a dual-region bucket setup. If the bucket is designated a single or multi-region, the variable are null. | <pre>object({<br> data_locations = list(string)<br> })</pre> | n/a | yes |

4-projects/modules/base_env/business_unit_folder.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ locals {
1919
}
2020

2121
resource "google_folder" "env_business_unit" {
22-
display_name = local.env_business_unit_folder_name
23-
parent = local.env_folder_name
22+
display_name = local.env_business_unit_folder_name
23+
parent = local.env_folder_name
24+
deletion_protection = var.folder_deletion_protection
2425
}

4-projects/modules/base_env/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,3 +186,9 @@ variable "project_deletion_policy" {
186186
type = string
187187
default = "PREVENT"
188188
}
189+
190+
variable "folder_deletion_protection" {
191+
description = "Prevent Terraform from destroying or recreating the folder."
192+
type = string
193+
default = true
194+
}

helpers/foundation-deployer/global.tfvars.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ foundation_code_path = "FULL_PATH_TO_FOLDER_WHERE_THE_EXAMPLE_FOUNDATION_CODE_WA
2727
// See https://cloud.google.com/sdk/gcloud/reference/config/set#EXAMPLES
2828
validator_project_id = "EXISTING_PROJECT_ID"
2929

30+
project_deletion_policy = "DELETE"
31+
folder_deletion_protection = false
3032

3133
// 0-bootstrap inputs
3234
// https://github.com/terraform-google-modules/terraform-example-foundation/blob/master/0-bootstrap/README.md#inputs

0 commit comments

Comments
 (0)