Skip to content

Commit af48cd3

Browse files
feat!: adds settings.deletion_protection_enabled to modules (#404)
Co-authored-by: Andrew Peabody <[email protected]>
1 parent 7d6b209 commit af48cd3

File tree

16 files changed

+48
-16
lines changed

16 files changed

+48
-16
lines changed

modules/mssql/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ The following dependency must be available for SQL Server module:
2323
| db\_name | The name of the default database to create | `string` | `"default"` | no |
2424
| delete\_timeout | The optional timeout that is applied to limit long database deletes. | `string` | `"30m"` | no |
2525
| deletion\_protection | Used to block Terraform from deleting a SQL Instance. | `bool` | `true` | no |
26+
| deletion\_protection\_enabled | Enables protection of an instance from accidental deletion protection across all surfaces (API, gcloud, Cloud Console and Terraform). | `bool` | `false` | no |
2627
| deny\_maintenance\_period | The Deny Maintenance Period fields to prevent automatic maintenance from occurring during a 90-day time period. See [more details](https://cloud.google.com/sql/docs/sqlserver/maintenance) | <pre>list(object({<br> end_date = string<br> start_date = string<br> time = string<br> }))</pre> | `[]` | no |
2728
| disk\_autoresize | Configuration to increase storage size. | `bool` | `true` | no |
2829
| disk\_autoresize\_limit | The maximum size to which storage can be auto increased. | `number` | `0` | no |

modules/mssql/main.tf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,10 @@ resource "google_sql_database_instance" "default" {
5151
deletion_protection = var.deletion_protection
5252

5353
settings {
54-
tier = var.tier
55-
activation_policy = var.activation_policy
56-
availability_type = var.availability_type
54+
tier = var.tier
55+
activation_policy = var.activation_policy
56+
availability_type = var.availability_type
57+
deletion_protection_enabled = var.deletion_protection_enabled
5758
dynamic "backup_configuration" {
5859
for_each = var.backup_configuration.enabled ? [var.backup_configuration] : []
5960
content {

modules/mssql/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ variable "availability_type" {
8080
default = "ZONAL"
8181
}
8282

83+
variable "deletion_protection_enabled" {
84+
description = "Enables protection of an instance from accidental deletion protection across all surfaces (API, gcloud, Cloud Console and Terraform)."
85+
type = bool
86+
default = false
87+
}
88+
8389
variable "disk_autoresize" {
8490
description = "Configuration to increase storage size."
8591
type = bool

modules/mssql/versions.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ terraform {
2020

2121
google = {
2222
source = "hashicorp/google"
23-
version = ">= 4.45.0, < 5.0"
23+
version = ">= 4.48.0, < 5.0"
2424
}
2525
google-beta = {
2626
source = "hashicorp/google-beta"
27-
version = ">= 4.45.0, < 5.0"
27+
version = ">= 4.48.0, < 5.0"
2828
}
2929
random = {
3030
source = "hashicorp/random"

modules/mysql/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Note: CloudSQL provides [disk autoresize](https://cloud.google.com/sql/docs/mysq
2020
| db\_name | The name of the default database to create | `string` | `"default"` | no |
2121
| delete\_timeout | The optional timout that is applied to limit long database deletes. | `string` | `"10m"` | no |
2222
| deletion\_protection | Used to block Terraform from deleting a SQL Instance. | `bool` | `true` | no |
23+
| deletion\_protection\_enabled | Enables protection of an instance from accidental deletion protection across all surfaces (API, gcloud, Cloud Console and Terraform). | `bool` | `false` | no |
2324
| deny\_maintenance\_period | The Deny Maintenance Period fields to prevent automatic maintenance from occurring during a 90-day time period. See [more details](https://cloud.google.com/sql/docs/mysql/maintenance) | <pre>list(object({<br> end_date = string<br> start_date = string<br> time = string<br> }))</pre> | `[]` | no |
2425
| disk\_autoresize | Configuration to increase storage size | `bool` | `true` | no |
2526
| disk\_autoresize\_limit | The maximum size to which storage can be auto increased. | `number` | `0` | no |

modules/mysql/main.tf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@ resource "google_sql_database_instance" "default" {
5050
deletion_protection = var.deletion_protection
5151

5252
settings {
53-
tier = var.tier
54-
activation_policy = var.activation_policy
55-
availability_type = var.availability_type
53+
tier = var.tier
54+
activation_policy = var.activation_policy
55+
availability_type = var.availability_type
56+
deletion_protection_enabled = var.deletion_protection_enabled
5657
dynamic "backup_configuration" {
5758
for_each = [var.backup_configuration]
5859
content {

modules/mysql/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ variable "availability_type" {
8585
default = "REGIONAL"
8686
}
8787

88+
variable "deletion_protection_enabled" {
89+
description = "Enables protection of an instance from accidental deletion protection across all surfaces (API, gcloud, Cloud Console and Terraform)."
90+
type = bool
91+
default = false
92+
}
93+
8894
variable "disk_autoresize" {
8995
description = "Configuration to increase storage size"
9096
type = bool

modules/mysql/versions.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ terraform {
2727
}
2828
google = {
2929
source = "hashicorp/google"
30-
version = ">= 4.45.0, < 5.0"
30+
version = ">= 4.48.0, < 5.0"
3131
}
3232
google-beta = {
3333
source = "hashicorp/google-beta"
34-
version = ">= 4.45.0, < 5.0"
34+
version = ">= 4.48.0, < 5.0"
3535
}
3636
}
3737

modules/postgresql/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Note: CloudSQL provides [disk autoresize](https://cloud.google.com/sql/docs/mysq
2121
| db\_name | The name of the default database to create | `string` | `"default"` | no |
2222
| delete\_timeout | The optional timout that is applied to limit long database deletes. | `string` | `"15m"` | no |
2323
| deletion\_protection | Used to block Terraform from deleting a SQL Instance. | `bool` | `true` | no |
24+
| deletion\_protection\_enabled | Enables protection of an instance from accidental deletion protection across all surfaces (API, gcloud, Cloud Console and Terraform). | `bool` | `false` | no |
2425
| deny\_maintenance\_period | The Deny Maintenance Period fields to prevent automatic maintenance from occurring during a 90-day time period. See [more details](https://cloud.google.com/sql/docs/postgres/maintenance) | <pre>list(object({<br> end_date = string<br> start_date = string<br> time = string<br> }))</pre> | `[]` | no |
2526
| disk\_autoresize | Configuration to increase storage size. | `bool` | `true` | no |
2627
| disk\_autoresize\_limit | The maximum size to which storage can be auto increased. | `number` | `0` | no |

modules/postgresql/main.tf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,10 @@ resource "google_sql_database_instance" "default" {
5555
deletion_protection = var.deletion_protection
5656

5757
settings {
58-
tier = var.tier
59-
activation_policy = var.activation_policy
60-
availability_type = var.availability_type
58+
tier = var.tier
59+
activation_policy = var.activation_policy
60+
availability_type = var.availability_type
61+
deletion_protection_enabled = var.deletion_protection_enabled
6162

6263
dynamic "backup_configuration" {
6364
for_each = [var.backup_configuration]

0 commit comments

Comments
 (0)