Skip to content

Commit 69e1911

Browse files
authored
feat: Add deletion_protection variable, defaulted to true (#151)
1 parent 3e26f5a commit 69e1911

File tree

9 files changed

+23
-0
lines changed

9 files changed

+23
-0
lines changed

modules/mssql/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ The following dependency must be available for SQL Server module:
2222
| db\_collation | The collation for the default database. Example: 'en_US.UTF8' | string | `""` | no |
2323
| db\_name | The name of the default database to create | string | `"default"` | no |
2424
| delete\_timeout | The optional timout that is applied to limit long database deletes. | string | `"30m"` | no |
25+
| deletion\_protection | Used to block Terraform from deleting a SQL Instance. | bool | `"true"` | no |
2526
| disk\_autoresize | Configuration to increase storage size. | bool | `"true"` | no |
2627
| disk\_size | The disk size for the master instance. | string | `"10"` | no |
2728
| disk\_type | The disk type for the master instance. | string | `"PD_SSD"` | no |

modules/mssql/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ resource "google_sql_database_instance" "default" {
4545
region = var.region
4646
encryption_key_name = var.encryption_key_name
4747
root_password = coalesce(var.root_password, random_password.root-password.result)
48+
deletion_protection = var.deletion_protection
4849

4950
settings {
5051
tier = var.tier

modules/mssql/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,3 +246,9 @@ variable "encryption_key_name" {
246246
type = string
247247
default = null
248248
}
249+
250+
variable "deletion_protection" {
251+
description = "Used to block Terraform from deleting a SQL Instance."
252+
type = bool
253+
default = true
254+
}

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\_collation | The collation for the default database. Example: 'utf8_general_ci' | string | `""` | no |
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 | `"10m"` | no |
23+
| deletion\_protection | Used to block Terraform from deleting a SQL Instance. | bool | `"true"` | no |
2324
| disk\_autoresize | Configuration to increase storage size | bool | `"true"` | no |
2425
| disk\_size | The disk size for the master instance | number | `"10"` | no |
2526
| disk\_type | The disk type for the master instance. | string | `"PD_SSD"` | no |

modules/mysql/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ resource "google_sql_database_instance" "default" {
4646
database_version = var.database_version
4747
region = var.region
4848
encryption_key_name = var.encryption_key_name
49+
deletion_protection = var.deletion_protection
4950

5051
settings {
5152
tier = var.tier

modules/mysql/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,3 +279,9 @@ variable "module_depends_on" {
279279
type = list(any)
280280
default = []
281281
}
282+
283+
variable "deletion_protection" {
284+
description = "Used to block Terraform from deleting a SQL Instance."
285+
type = bool
286+
default = true
287+
}

modules/postgresql/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Note: CloudSQL provides [disk autoresize](https://cloud.google.com/sql/docs/mysq
1919
| db\_collation | The collation for the default database. Example: 'en_US.UTF8' | string | `""` | no |
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 |
22+
| deletion\_protection | Used to block Terraform from deleting a SQL Instance. | bool | `"true"` | no |
2223
| disk\_autoresize | Configuration to increase storage size. | bool | `"true"` | no |
2324
| disk\_size | The disk size for the master instance. | string | `"10"` | no |
2425
| disk\_type | The disk type for the master instance. | string | `"PD_SSD"` | no |

modules/postgresql/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ resource "google_sql_database_instance" "default" {
4141
database_version = var.database_version
4242
region = var.region
4343
encryption_key_name = var.encryption_key_name
44+
deletion_protection = var.deletion_protection
4445

4546
settings {
4647
tier = var.tier

modules/postgresql/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,3 +262,8 @@ variable "module_depends_on" {
262262
default = []
263263
}
264264

265+
variable "deletion_protection" {
266+
description = "Used to block Terraform from deleting a SQL Instance."
267+
type = bool
268+
default = true
269+
}

0 commit comments

Comments
 (0)