Skip to content

Commit f1666b3

Browse files
committed
feat!: set new deletion_policy default
1 parent b0ed8a5 commit f1666b3

File tree

17 files changed

+51
-5
lines changed

17 files changed

+51
-5
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ determining that location is as follows:
137137
| create\_project\_sa | Whether the default service account for the project shall be created | `bool` | `true` | no |
138138
| default\_network\_tier | Default Network Service Tier for resources created in this project. If unset, the value will not be modified. See https://cloud.google.com/network-tiers/docs/using-network-service-tiers and https://cloud.google.com/network-tiers. | `string` | `""` | no |
139139
| default\_service\_account | Project default service account setting: can be one of `delete`, `deprivilege`, `disable`, or `keep`. | `string` | `"disable"` | no |
140-
| deletion\_policy | The deletion policy for the project. | `string` | `null` | no |
140+
| deletion\_policy | The deletion policy for the project. | `string` | `"PREVENT"` | no |
141141
| disable\_dependent\_services | Whether services that are enabled and which depend on this service should also be disabled when this service is destroyed. | `bool` | `true` | no |
142142
| disable\_services\_on\_destroy | Whether project services will be disabled when the resources are destroyed | `bool` | `true` | no |
143143
| domain | The domain name (optional). | `string` | `""` | no |
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Upgrading to Project Factory v17.0
2+
3+
The v17.0 release of Project Factory is a backwards incompatible release.
4+
5+
### Google Cloud Provider Project deletion_policy
6+
7+
The `deletion_policy` for projects now defaults to `"PREVENT"` rather than `"DELETE"`. This aligns with the behavior in Google Cloud Platform Provider v6+. To maintain the old behavior you can set `deletion_policy = "DELETE"`.
8+
9+
```diff
10+
module "project" {
11+
- version = "~> 16.0"
12+
+ version = "~> 17.0"
13+
14+
+ deletion_policy = "DELETE"
15+
}
16+
```
17+
18+
### Google Cloud Platform Provider upgrade
19+
20+
The Project Factory module now requires version `5.41` or higher of the Google Cloud Platform Provider and `5.41` or higher of the Google Cloud Platform Beta Provider.

examples/app_engine/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ module "app-engine-project" {
3232
activate_apis = [
3333
"appengine.googleapis.com",
3434
]
35+
36+
deletion_policy = "DELETE"
3537
}
3638

3739
module "app-engine" {

examples/budget_project/main.tf

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ module "budget_project" {
3838
"billingbudgets.googleapis.com"
3939
]
4040

41+
deletion_policy = "DELETE"
4142
}
4243

4344

examples/essential_contacts/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,6 @@ module "project-factory" {
4141

4242
default_service_account = "DISABLE"
4343
disable_services_on_destroy = false
44+
45+
deletion_policy = "DELETE"
4446
}

examples/fabric_project/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,6 @@ module "fabric-project" {
3535
owners = var.owners
3636
parent = var.parent
3737
prefix = local.prefix
38+
39+
deletion_policy = "DELETE"
3840
}

examples/gke_shared_vpc/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,6 @@ module "project-factory" {
2626
activate_apis = ["compute.googleapis.com", "container.googleapis.com", "cloudbilling.googleapis.com"]
2727
shared_vpc_subnets = var.shared_vpc_subnets
2828
default_network_tier = var.default_network_tier
29+
30+
deletion_policy = "DELETE"
2931
}

examples/quota_project/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,6 @@ module "quota-project" {
5858
value = "95"
5959
}
6060
]
61+
62+
deletion_policy = "DELETE"
6163
}

examples/shared_vpc/main.tf

+7
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ module "host-project" {
3939
"cloudresourcemanager.googleapis.com"
4040
]
4141

42+
deletion_policy = "DELETE"
4243
}
4344

4445
/******************************************
@@ -113,6 +114,8 @@ module "service-project" {
113114
]
114115

115116
disable_services_on_destroy = false
117+
118+
deletion_policy = "DELETE"
116119
}
117120

118121
/******************************************
@@ -146,6 +149,8 @@ module "service-project-b" {
146149
}]
147150

148151
disable_services_on_destroy = false
152+
153+
deletion_policy = "DELETE"
149154
}
150155

151156
/******************************************
@@ -184,6 +189,8 @@ module "service-project-c" {
184189

185190
disable_services_on_destroy = false
186191
grant_network_role = false
192+
193+
deletion_policy = "DELETE"
187194
}
188195

189196
/******************************************

examples/simple_project/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,6 @@ module "project-factory" {
3131
"roles/bigquery.jobUser",
3232
]
3333
}]
34+
35+
deletion_policy = "DELETE"
3436
}

examples/tags_project/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,6 @@ module "project-factory" {
2525
billing_account = var.billing_account
2626
default_service_account = "deprivilege"
2727
tag_binding_values = [var.tag_value]
28+
29+
deletion_policy = "DELETE"
2830
}

modules/core_project_factory/variables.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -280,5 +280,5 @@ variable "cloud_armor_tier" {
280280
variable "deletion_policy" {
281281
description = "The deletion policy for the project."
282282
type = string
283-
default = null
283+
default = "PREVENT"
284284
}

modules/fabric-project/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ module "project_myproject" {
3838
| auto\_create\_network | Whether to create the default network for the project | `bool` | `false` | no |
3939
| billing\_account | Billing account id. | `string` | `""` | no |
4040
| custom\_roles | Map of role name => comma-delimited list of permissions to create in this project. | `map(string)` | `{}` | no |
41-
| deletion\_policy | The deletion policy for the project. | `string` | `null` | no |
41+
| deletion\_policy | The deletion policy for the project. | `string` | `"PREVENT"` | no |
4242
| editors | Optional list of IAM-format members to set as project editor. | `list(string)` | `[]` | no |
4343
| extra\_bindings\_members | List of comma-delimited IAM-format members for additional IAM bindings, one item per role. | `list(string)` | `[]` | no |
4444
| extra\_bindings\_roles | List of roles for additional IAM bindings, pair with members list below. | `list(string)` | `[]` | no |

modules/fabric-project/variables.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,5 +125,5 @@ variable "labels" {
125125
variable "deletion_policy" {
126126
description = "The deletion policy for the project."
127127
type = string
128-
default = null
128+
default = "PREVENT"
129129
}

test/fixtures/minimal/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ module "project-factory" {
4949

5050
default_service_account = "DISABLE"
5151
disable_services_on_destroy = false
52+
53+
deletion_policy = "DELETE"
5254
}
5355

5456
// Add a binding to the container service robot account to test that the

test/fixtures/vpc_sc_project/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ module "project-factory" {
5050

5151
vpc_service_control_attach_enabled = true
5252
vpc_service_control_perimeter_name = "accessPolicies/${var.policy_id}/servicePerimeters/${local.perimeter_name}"
53+
54+
deletion_policy = "DELETE"
5355
}
5456

5557
resource "google_project_iam_member" "iam-binding" {

variables.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -369,5 +369,5 @@ variable "cloud_armor_tier" {
369369
variable "deletion_policy" {
370370
description = "The deletion policy for the project."
371371
type = string
372-
default = null
372+
default = "PREVENT"
373373
}

0 commit comments

Comments
 (0)