Skip to content

Commit 7eb2b92

Browse files
authored
feat(TPG>=6)!: upgrade to TPGv6 (#84)
1 parent aa3c9df commit 7eb2b92

File tree

7 files changed

+47
-6
lines changed

7 files changed

+47
-6
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ Functional examples are included in the
6767
| Name | Description | Type | Default | Required |
6868
|------|-------------|------|---------|:--------:|
6969
| all\_folder\_admins | List of IAM-style members that will get the extended permissions across all the folders. | `list(string)` | `[]` | no |
70+
| deletion\_protection | Prevent Terraform from destroying or recreating the folder. | `bool` | `true` | no |
7071
| folder\_admin\_roles | List of roles that will be applied to a folder if roles are not explictly specified in per\_folder\_admins | `list(string)` | <pre>[<br> "roles/owner",<br> "roles/resourcemanager.folderViewer",<br> "roles/resourcemanager.projectCreator",<br> "roles/compute.networkAdmin"<br>]</pre> | no |
7172
| names | Folder names. | `list(string)` | `[]` | no |
7273
| parent | The resource name of the parent Folder or Organization. Must be of the form folders/folder\_id or organizations/org\_id | `string` | n/a | yes |

docs/upgrading_to_folders_v5.0.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Upgrading to v5.0
2+
3+
The v5.0 release of the *Folders* module is a backwards incompatible release.
4+
5+
### Google Cloud Platform Provider upgrade
6+
The *Folders* module now requires version 6.0 or higher of the Google Cloud Platform Providers.
7+
8+
```diff
9+
terraform {
10+
required_providers {
11+
google = {
12+
source = "hashicorp/google"
13+
- version = "~> 5.0"
14+
+ version = "~> 6.0"
15+
}
16+
}
17+
}
18+
```
19+
20+
### Deletion Protection
21+
The *Folders* Module now includes the `deletion_protection` option which defaults to `true`. To delete your folders using Terraform, you should specify it explicitly to `false`:
22+
23+
```diff
24+
module "gke" {
25+
- source = "terraform-google-modules/folders/google"
26+
- version = "~> 4.0"
27+
+ source = "terraform-google-modules/folders/google"
28+
+ version = "~> 5.0"
29+
...
30+
+ deletion_protection = false
31+
}
32+
```

examples/simple_example/main.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ module "folders" {
2222
set_roles = true
2323
all_folder_admins = var.all_folder_admins
2424

25+
deletion_protection = false
26+
2527
names = [
2628
"dev",
2729
"staging",

main.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ locals {
3333
resource "google_folder" "folders" {
3434
for_each = toset(var.names)
3535

36-
display_name = "${local.prefix}${each.value}"
37-
parent = var.parent
36+
display_name = "${local.prefix}${each.value}"
37+
parent = var.parent
38+
deletion_protection = var.deletion_protection
3839
}
3940

4041
# give project creation access to service accounts

test/setup/versions.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515
*/
1616

1717
terraform {
18-
required_version = ">= 0.13"
18+
required_version = ">= 1.3.0"
1919
required_providers {
2020
google = {
2121
source = "hashicorp/google"
22-
version = ">= 3.38, < 6"
22+
version = ">= 3.38, < 7"
2323
}
2424
google-beta = {
2525
source = "hashicorp/google-beta"
26-
version = ">= 3.38, < 6"
26+
version = ">= 3.38, < 7"
2727
}
2828
random = {
2929
source = "hashicorp/random"

variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,8 @@ variable "folder_admin_roles" {
6464
]
6565
}
6666

67+
variable "deletion_protection" {
68+
type = bool
69+
description = "Prevent Terraform from destroying or recreating the folder."
70+
default = true
71+
}

versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ terraform {
2020
required_providers {
2121
google = {
2222
source = "hashicorp/google"
23-
version = ">= 3.45, < 6"
23+
version = ">= 6.0.0, < 7"
2424
}
2525

2626
random = {

0 commit comments

Comments
 (0)