Skip to content

Commit

Permalink
feat!: set new deletion_policy default
Browse files Browse the repository at this point in the history
  • Loading branch information
apeabody committed Sep 6, 2024
1 parent b0ed8a5 commit 9eeaeea
Show file tree
Hide file tree
Showing 14 changed files with 40 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ determining that location is as follows:
| create\_project\_sa | Whether the default service account for the project shall be created | `bool` | `true` | no |
| 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 |
| default\_service\_account | Project default service account setting: can be one of `delete`, `deprivilege`, `disable`, or `keep`. | `string` | `"disable"` | no |
| deletion\_policy | The deletion policy for the project. | `string` | `null` | no |
| deletion\_policy | The deletion policy for the project. | `string` | `"RETAIN"` | no |
| 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 |
| disable\_services\_on\_destroy | Whether project services will be disabled when the resources are destroyed | `bool` | `true` | no |
| domain | The domain name (optional). | `string` | `""` | no |
Expand Down
20 changes: 20 additions & 0 deletions docs/upgrading_to_project_factory_v17.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Upgrading to Project Factory v17.0

The v17.0 release of Project Factory is a backwards incompatible release.

### Google Cloud Provider Project deletion_policy

The `deletion_policy` for projects now defaults to `"RETAIN"` 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"`.

```diff
module "project" {
- version = "~> 16.0"
+ version = "~> 17.0"

+ deletion_policy = "DELETE"
}
```

### Google Cloud Platform Provider upgrade

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.
2 changes: 2 additions & 0 deletions examples/app_engine/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ module "app-engine-project" {
activate_apis = [
"appengine.googleapis.com",
]

deletion_policy = "DELETE"
}

module "app-engine" {
Expand Down
1 change: 1 addition & 0 deletions examples/budget_project/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ module "budget_project" {
"billingbudgets.googleapis.com"
]

deletion_policy = "DELETE"
}


Expand Down
2 changes: 2 additions & 0 deletions examples/essential_contacts/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,6 @@ module "project-factory" {

default_service_account = "DISABLE"
disable_services_on_destroy = false

deletion_policy = "DELETE"
}
2 changes: 2 additions & 0 deletions examples/fabric_project/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,6 @@ module "fabric-project" {
owners = var.owners
parent = var.parent
prefix = local.prefix

deletion_policy = "DELETE"
}
2 changes: 2 additions & 0 deletions examples/gke_shared_vpc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@ module "project-factory" {
activate_apis = ["compute.googleapis.com", "container.googleapis.com", "cloudbilling.googleapis.com"]
shared_vpc_subnets = var.shared_vpc_subnets
default_network_tier = var.default_network_tier

deletion_policy = "DELETE"
}
2 changes: 2 additions & 0 deletions examples/quota_project/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,6 @@ module "quota-project" {
value = "95"
}
]

deletion_policy = "DELETE"
}
2 changes: 2 additions & 0 deletions examples/simple_project/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,6 @@ module "project-factory" {
"roles/bigquery.jobUser",
]
}]

deletion_policy = "DELETE"
}
2 changes: 2 additions & 0 deletions examples/tags_project/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ module "project-factory" {
billing_account = var.billing_account
default_service_account = "deprivilege"
tag_binding_values = [var.tag_value]

deletion_policy = "DELETE"
}
2 changes: 1 addition & 1 deletion modules/core_project_factory/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -280,5 +280,5 @@ variable "cloud_armor_tier" {
variable "deletion_policy" {
description = "The deletion policy for the project."
type = string
default = null
default = "RETAIN"
}
2 changes: 1 addition & 1 deletion modules/fabric-project/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module "project_myproject" {
| auto\_create\_network | Whether to create the default network for the project | `bool` | `false` | no |
| billing\_account | Billing account id. | `string` | `""` | no |
| custom\_roles | Map of role name => comma-delimited list of permissions to create in this project. | `map(string)` | `{}` | no |
| deletion\_policy | The deletion policy for the project. | `string` | `null` | no |
| deletion\_policy | The deletion policy for the project. | `string` | `"RETAIN"` | no |
| editors | Optional list of IAM-format members to set as project editor. | `list(string)` | `[]` | no |
| extra\_bindings\_members | List of comma-delimited IAM-format members for additional IAM bindings, one item per role. | `list(string)` | `[]` | no |
| extra\_bindings\_roles | List of roles for additional IAM bindings, pair with members list below. | `list(string)` | `[]` | no |
Expand Down
2 changes: 1 addition & 1 deletion modules/fabric-project/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,5 @@ variable "labels" {
variable "deletion_policy" {
description = "The deletion policy for the project."
type = string
default = null
default = "RETAIN"
}
2 changes: 1 addition & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -369,5 +369,5 @@ variable "cloud_armor_tier" {
variable "deletion_policy" {
description = "The deletion policy for the project."
type = string
default = null
default = "RETAIN"
}

0 comments on commit 9eeaeea

Please sign in to comment.