Skip to content

Commit e2f2d60

Browse files
MINOR: SRE-3422: enable deletion protection on GCP side (#36)
* SRE-3422: run periodic jenkins job to enable deletion protection on sql * SRE-3422: tflint
1 parent 7b9224b commit e2f2d60

File tree

7 files changed

+16
-44
lines changed

7 files changed

+16
-44
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@ This modules creates the following resources:
2020
|------|---------|
2121
| terraform | >= 1.0.0 |
2222
| google | >= 3.18.0, <5.0.0 |
23+
| random | > 3.0.0 |
2324

2425
## Providers
2526

2627
| Name | Version |
2728
|------|---------|
2829
| google | >= 3.18.0, <5.0.0 |
29-
| random | n/a |
30+
| random | > 3.0.0 |
3031

3132
## Inputs
3233

@@ -41,7 +42,7 @@ This modules creates the following resources:
4142
| cloudsql\_availability\_type | The availability type of the Cloud SQL instance, high availability (REGIONAL) or single zone (ZONAL). | `string` | `"REGIONAL"` | no |
4243
| database\_flags | List of Cloud SQL flags that are applied to the database server. See [more details](https://cloud.google.com/sql/docs/mysql/flags) | <pre>list(object({<br> name = string<br> value = string<br> }))</pre> | `[]` | no |
4344
| db\_name | name of the database | `string` | `"doit"` | no |
44-
| deletion\_protection | Set deletion protection on Cloud SQL instance. Unless this field is set to false, a terraform destroy or terraform apply command that deletes the instance will fail. | `bool` | `true` | no |
45+
| deletion\_protection | Set deletion protection on Cloud SQL instance. Setting this will protect instances from accidental deletion across all surfaces (API, gcloud, Cloud Console and Terraform). | `bool` | `true` | no |
4546
| disk\_autoresize | Enable disk to autoresize itself | `bool` | `true` | no |
4647
| disk\_size | size of the disk to use | `number` | `100` | no |
4748
| disk\_type | The disk type to use on the instance. should be either PD\_SSD or PD\_STANDARD | `string` | `"PD_SSD"` | no |

examples/minimal/README.md

Lines changed: 0 additions & 21 deletions
This file was deleted.

examples/minimal/main.tf

Lines changed: 0 additions & 6 deletions
This file was deleted.

examples/minimal/variables.tf

Lines changed: 0 additions & 7 deletions
This file was deleted.

main.tf

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@ resource "google_sql_database_instance" "tamr" {
2121
}
2222

2323
settings {
24-
tier = var.tier
25-
disk_size = var.disk_size
26-
disk_type = var.disk_type
27-
activation_policy = var.activation_policy
28-
disk_autoresize = var.disk_autoresize
29-
user_labels = var.labels
30-
availability_type = var.cloudsql_availability_type
24+
tier = var.tier
25+
disk_size = var.disk_size
26+
disk_type = var.disk_type
27+
activation_policy = var.activation_policy
28+
disk_autoresize = var.disk_autoresize
29+
user_labels = var.labels
30+
availability_type = var.cloudsql_availability_type
31+
deletion_protection_enabled = var.deletion_protection
3132

3233
dynamic "backup_configuration" {
3334
for_each = var.backup_enabled ? ["true"] : []

variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ variable "database_flags" {
9797

9898
variable "deletion_protection" {
9999
type = bool
100-
description = "Set deletion protection on Cloud SQL instance. Unless this field is set to false, a terraform destroy or terraform apply command that deletes the instance will fail."
100+
description = "Set deletion protection on Cloud SQL instance. Setting this will protect instances from accidental deletion across all surfaces (API, gcloud, Cloud Console and Terraform)."
101101
default = true
102102
}
103103

version.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,9 @@ terraform {
55
source = "hashicorp/google"
66
version = ">= 3.18.0, <5.0.0"
77
}
8+
random = {
9+
source = "hashicorp/random"
10+
version = "> 3.0.0"
11+
}
812
}
913
}

0 commit comments

Comments
 (0)