Skip to content

Commit 55f4206

Browse files
feat!: Add deny_maintenance_period for MySQL, MsSQL, PostgreSQL and safer_sql (#399)
Co-authored-by: g-awmalik <[email protected]>
1 parent cc39074 commit 55f4206

File tree

17 files changed

+79
-10
lines changed

17 files changed

+79
-10
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ The root module has been deprecated. Please switch to using one of the submodule
3636
### Installation Dependencies
3737

3838
- [Terraform](https://www.terraform.io/downloads.html) >= 0.13.0
39-
- [terraform-provider-google](https://github.com/terraform-providers/terraform-provider-google) plugin >= v4.4.0
39+
- [terraform-provider-google](https://github.com/terraform-providers/terraform-provider-google) plugin >= v4.45.0
4040

4141
The following dependency must be available for SQL Server module:
4242

43-
- [Terraform Provider Beta for GCP](https://github.com/terraform-providers/terraform-provider-google-beta) plugin >= v4.22.0
43+
- [Terraform Provider Beta for GCP](https://github.com/terraform-providers/terraform-provider-google-beta) plugin >= v4.45.0
4444

4545
### Configure a Service Account
4646

modules/mssql/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
The following dependency must be available for SQL Server module:
44

5-
- [Terraform Provider Beta for GCP](https://github.com/terraform-providers/terraform-provider-google-beta) plugin >= 4.22.0
5+
- [Terraform Provider Beta for GCP](https://github.com/terraform-providers/terraform-provider-google-beta) plugin >= 4.45.0
66

77
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
88
## Inputs
@@ -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+
| 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 |
2627
| disk\_autoresize | Configuration to increase storage size. | `bool` | `true` | no |
2728
| disk\_autoresize\_limit | The maximum size to which storage can be auto increased. | `number` | `0` | no |
2829
| disk\_size | The disk size for the master instance. | `number` | `10` | no |

modules/mssql/main.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,14 @@ resource "google_sql_database_instance" "default" {
7272
}
7373
}
7474
}
75+
dynamic "deny_maintenance_period" {
76+
for_each = var.deny_maintenance_period
77+
content {
78+
end_date = lookup(deny_maintenance_period.value, "end_date", null)
79+
start_date = lookup(deny_maintenance_period.value, "start_date", null)
80+
time = lookup(deny_maintenance_period.value, "time", null)
81+
}
82+
}
7583
dynamic "ip_configuration" {
7684
for_each = [local.ip_configurations[local.ip_configuration_enabled ? "enabled" : "disabled"]]
7785
content {

modules/mssql/variables.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,16 @@ variable "maintenance_window_update_track" {
128128
default = "canary"
129129
}
130130

131+
variable "deny_maintenance_period" {
132+
description = "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)"
133+
type = list(object({
134+
end_date = string
135+
start_date = string
136+
time = string
137+
}))
138+
default = []
139+
}
140+
131141
variable "database_flags" {
132142
description = "The database flags for the master instance. See [more details](https://cloud.google.com/sql/docs/sqlserver/flags)"
133143
type = list(object({

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.28.0, < 5.0"
23+
version = ">= 4.45.0, < 5.0"
2424
}
2525
google-beta = {
2626
source = "hashicorp/google-beta"
27-
version = ">= 4.28.0, < 5.0"
27+
version = ">= 4.45.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+
| 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 |
2324
| disk\_autoresize | Configuration to increase storage size | `bool` | `true` | no |
2425
| disk\_autoresize\_limit | The maximum size to which storage can be auto increased. | `number` | `0` | no |
2526
| disk\_size | The disk size for the master instance | `number` | `10` | no |

modules/mysql/main.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,14 @@ resource "google_sql_database_instance" "default" {
8181
record_client_address = lookup(insights_config.value, "record_client_address", false)
8282
}
8383
}
84+
dynamic "deny_maintenance_period" {
85+
for_each = var.deny_maintenance_period
86+
content {
87+
end_date = lookup(deny_maintenance_period.value, "end_date", null)
88+
start_date = lookup(deny_maintenance_period.value, "start_date", null)
89+
time = lookup(deny_maintenance_period.value, "time", null)
90+
}
91+
}
8492
dynamic "ip_configuration" {
8593
for_each = [local.ip_configurations[local.ip_configuration_enabled ? "enabled" : "disabled"]]
8694
content {

modules/mysql/variables.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,16 @@ variable "user_labels" {
149149
description = "The key/value labels for the master instances."
150150
}
151151

152+
variable "deny_maintenance_period" {
153+
description = "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)"
154+
type = list(object({
155+
end_date = string
156+
start_date = string
157+
time = string
158+
}))
159+
default = []
160+
}
161+
152162
variable "backup_configuration" {
153163
description = "The backup_configuration settings subblock for the database setings"
154164
type = object({

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.28.0, < 5.0"
30+
version = ">= 4.45.0, < 5.0"
3131
}
3232
google-beta = {
3333
source = "hashicorp/google-beta"
34-
version = ">= 4.4.0, < 5.0"
34+
version = ">= 4.45.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+
| 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 |
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 |
2627
| disk\_size | The disk size for the master instance. | `number` | `10` | no |

0 commit comments

Comments
 (0)