Skip to content

Commit 64618c4

Browse files
authored
feat: added enable_private_path_for_google_cloud_services field in ip_configuration for google_sql_database_instance resource (#449)
1 parent 387d266 commit 64618c4

File tree

11 files changed

+115
-63
lines changed

11 files changed

+115
-63
lines changed

modules/mssql/metadata.yaml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ spec:
2323
source:
2424
repo: https://github.com/terraform-google-modules/terraform-google-sql-db
2525
sourceType: git
26-
version: 13.0.1
26+
version: 14.1.0
2727
actuationTool:
2828
type: Terraform
2929
version: '>= 0.13'
@@ -106,7 +106,7 @@ spec:
106106
- name: create_timeout
107107
description: The optional timeout that is applied to limit long database creates.
108108
type: string
109-
default: 15m
109+
default: 30m
110110
required: false
111111
- name: database_flags
112112
description: The database flags for the master instance. See [more details](https://cloud.google.com/sql/docs/sqlserver/flags)
@@ -147,6 +147,21 @@ spec:
147147
type: bool
148148
default: true
149149
required: false
150+
- name: deletion_protection_enabled
151+
description: Enables protection of an instance from accidental deletion protection across all surfaces (API, gcloud, Cloud Console and Terraform).
152+
type: bool
153+
default: false
154+
required: false
155+
- name: deny_maintenance_period
156+
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)
157+
type: |-
158+
list(object({
159+
end_date = string
160+
start_date = string
161+
time = string
162+
}))
163+
default: []
164+
required: false
150165
- name: disk_autoresize
151166
description: Configuration to increase storage size.
152167
type: bool
@@ -257,7 +272,7 @@ spec:
257272
- name: update_timeout
258273
description: The optional timeout that is applied to limit long database updates.
259274
type: string
260-
default: 15m
275+
default: 30m
261276
required: false
262277
- name: user_labels
263278
description: The key/value labels for the master instances.

modules/mysql/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Note: CloudSQL provides [disk autoresize](https://cloud.google.com/sql/docs/mysq
1212
| additional\_users | A list of users to be created in your cluster. A random password would be set for the user if the `random_password` variable is set. | <pre>list(object({<br> name = string<br> password = string<br> random_password = bool<br> type = string<br> host = string<br> }))</pre> | `[]` | no |
1313
| availability\_type | The availability type for the master instance. Can be either `REGIONAL` or `null`. | `string` | `"REGIONAL"` | no |
1414
| backup\_configuration | The backup\_configuration settings subblock for the database setings | <pre>object({<br> binary_log_enabled = bool<br> enabled = bool<br> start_time = string<br> location = string<br> transaction_log_retention_days = string<br> retained_backups = number<br> retention_unit = string<br> })</pre> | <pre>{<br> "binary_log_enabled": false,<br> "enabled": false,<br> "location": null,<br> "retained_backups": null,<br> "retention_unit": null,<br> "start_time": null,<br> "transaction_log_retention_days": null<br>}</pre> | no |
15-
| connector\_enforcement | Force clients to use the connector. See[more details](https://cloud.google.com/sql/docs/mysql/connect-connectors). | `bool` | `false` | no |
15+
| connector\_enforcement | Enforce that clients use the connector library | `bool` | `false` | no |
1616
| create\_timeout | The optional timout that is applied to limit long database creates. | `string` | `"30m"` | no |
1717
| 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 |
1818
| database\_version | The database version to use | `string` | n/a | yes |
@@ -33,7 +33,7 @@ Note: CloudSQL provides [disk autoresize](https://cloud.google.com/sql/docs/mysq
3333
| encryption\_key\_name | The full path to the encryption key used for the CMEK disk encryption | `string` | `null` | no |
3434
| follow\_gae\_application | A Google App Engine application whose zone to remain in. Must be in the same region as this instance. | `string` | `null` | no |
3535
| insights\_config | The insights\_config settings for the database. | <pre>object({<br> query_string_length = number<br> record_application_tags = bool<br> record_client_address = bool<br> })</pre> | `null` | no |
36-
| ip\_configuration | The ip\_configuration settings subblock | <pre>object({<br> authorized_networks = list(map(string))<br> ipv4_enabled = bool<br> private_network = string<br> require_ssl = bool<br> allocated_ip_range = string<br> })</pre> | <pre>{<br> "allocated_ip_range": null,<br> "authorized_networks": [],<br> "ipv4_enabled": true,<br> "private_network": null,<br> "require_ssl": null<br>}</pre> | no |
36+
| ip\_configuration | The ip\_configuration settings subblock | <pre>object({<br> authorized_networks = list(map(string))<br> ipv4_enabled = bool<br> private_network = string<br> require_ssl = bool<br> allocated_ip_range = string<br> enable_private_path_for_google_cloud_services = optional(bool)<br> })</pre> | <pre>{<br> "allocated_ip_range": null,<br> "authorized_networks": [],<br> "enable_private_path_for_google_cloud_services": false,<br> "ipv4_enabled": true,<br> "private_network": null,<br> "require_ssl": null<br>}</pre> | no |
3737
| maintenance\_window\_day | The day of week (1-7) for the master instance maintenance. | `number` | `1` | no |
3838
| maintenance\_window\_hour | The hour of day (0-23) maintenance window for the master instance maintenance. | `number` | `23` | no |
3939
| maintenance\_window\_update\_track | The update track of maintenance window for the master instance maintenance. Can be either `canary` or `stable`. | `string` | `"canary"` | no |

modules/mysql/main.tf

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ locals {
3333
retained_backups = lookup(var.backup_configuration, "retained_backups", null)
3434
retention_unit = lookup(var.backup_configuration, "retention_unit", null)
3535

36-
// Force the usage of connector_enforcement
36+
// Force the usage of connector_enforcement
3737
connector_enforcement = var.connector_enforcement ? "REQUIRED" : "NOT_REQUIRED"
3838
}
3939

@@ -59,6 +59,7 @@ resource "google_sql_database_instance" "default" {
5959
availability_type = var.availability_type
6060
deletion_protection_enabled = var.deletion_protection_enabled
6161
connector_enforcement = local.connector_enforcement
62+
6263
dynamic "backup_configuration" {
6364
for_each = [var.backup_configuration]
6465
content {
@@ -108,10 +109,11 @@ resource "google_sql_database_instance" "default" {
108109
dynamic "ip_configuration" {
109110
for_each = [local.ip_configurations[local.ip_configuration_enabled ? "enabled" : "disabled"]]
110111
content {
111-
ipv4_enabled = lookup(ip_configuration.value, "ipv4_enabled", null)
112-
private_network = lookup(ip_configuration.value, "private_network", null)
113-
require_ssl = lookup(ip_configuration.value, "require_ssl", null)
114-
allocated_ip_range = lookup(ip_configuration.value, "allocated_ip_range", null)
112+
ipv4_enabled = lookup(ip_configuration.value, "ipv4_enabled", null)
113+
private_network = lookup(ip_configuration.value, "private_network", null)
114+
require_ssl = lookup(ip_configuration.value, "require_ssl", null)
115+
allocated_ip_range = lookup(ip_configuration.value, "allocated_ip_range", null)
116+
enable_private_path_for_google_cloud_services = lookup(ip_configuration.value, "enable_private_path_for_google_cloud_services", false)
115117

116118
dynamic "authorized_networks" {
117119
for_each = lookup(ip_configuration.value, "authorized_networks", [])

modules/mysql/metadata.yaml

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ spec:
2323
source:
2424
repo: https://github.com/terraform-google-modules/terraform-google-sql-db
2525
sourceType: git
26-
version: 13.0.1
26+
version: 14.1.0
2727
actuationTool:
2828
type: Terraform
29-
version: '>= 0.13'
29+
version: '>= 1.3'
3030
examples:
3131
- name: mssql-public
3232
location: examples/mssql-public
@@ -101,14 +101,14 @@ spec:
101101
transaction_log_retention_days: null
102102
required: false
103103
- name: connector_enforcement
104-
description: Force the client to use the connector. See [more details](https://cloud.google.com/sql/docs/mysql/connect-connectors)
104+
description: Enforce that clients use the connector library
105105
type: bool
106106
default: false
107107
required: false
108108
- name: create_timeout
109109
description: The optional timout that is applied to limit long database creates.
110110
type: string
111-
default: 10m
111+
default: 30m
112112
required: false
113113
- name: database_flags
114114
description: List of Cloud SQL flags that are applied to the database server. See [more details](https://cloud.google.com/sql/docs/mysql/flags)
@@ -141,7 +141,7 @@ spec:
141141
- name: delete_timeout
142142
description: The optional timout that is applied to limit long database deletes.
143143
type: string
144-
default: 10m
144+
default: 30m
145145
required: false
146146
- name: deletion_protection
147147
description: Used to block Terraform from deleting a SQL Instance.
@@ -193,6 +193,11 @@ spec:
193193
type: bool
194194
default: true
195195
required: false
196+
- name: enable_random_password_special
197+
description: Enable special characters in generated random passwords.
198+
type: bool
199+
default: false
200+
required: false
196201
- name: encryption_key_name
197202
description: The full path to the encryption key used for the CMEK disk encryption
198203
type: string
@@ -214,15 +219,17 @@ spec:
214219
description: The ip_configuration settings subblock
215220
type: |-
216221
object({
217-
authorized_networks = list(map(string))
218-
ipv4_enabled = bool
219-
private_network = string
220-
require_ssl = bool
221-
allocated_ip_range = string
222+
authorized_networks = list(map(string))
223+
ipv4_enabled = bool
224+
private_network = string
225+
require_ssl = bool
226+
allocated_ip_range = string
227+
enable_private_path_for_google_cloud_services = optional(bool)
222228
})
223229
default:
224230
allocated_ip_range: null
225231
authorized_networks: []
232+
enable_private_path_for_google_cloud_services: false
226233
ipv4_enabled: true
227234
private_network: null
228235
require_ssl: null
@@ -341,7 +348,7 @@ spec:
341348
- name: update_timeout
342349
description: The optional timout that is applied to limit long database updates.
343350
type: string
344-
default: 10m
351+
default: 30m
345352
required: false
346353
- name: user_host
347354
description: The host for the default user

modules/mysql/variables.tf

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -200,18 +200,20 @@ variable "insights_config" {
200200
variable "ip_configuration" {
201201
description = "The ip_configuration settings subblock"
202202
type = object({
203-
authorized_networks = list(map(string))
204-
ipv4_enabled = bool
205-
private_network = string
206-
require_ssl = bool
207-
allocated_ip_range = string
203+
authorized_networks = list(map(string))
204+
ipv4_enabled = bool
205+
private_network = string
206+
require_ssl = bool
207+
allocated_ip_range = string
208+
enable_private_path_for_google_cloud_services = optional(bool)
208209
})
209210
default = {
210-
authorized_networks = []
211-
ipv4_enabled = true
212-
private_network = null
213-
require_ssl = null
214-
allocated_ip_range = null
211+
authorized_networks = []
212+
ipv4_enabled = true
213+
private_network = null
214+
require_ssl = null
215+
allocated_ip_range = null
216+
enable_private_path_for_google_cloud_services = false
215217
}
216218
}
217219

modules/postgresql/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Note: CloudSQL provides [disk autoresize](https://cloud.google.com/sql/docs/mysq
3434
| follow\_gae\_application | A Google App Engine application whose zone to remain in. Must be in the same region as this instance. | `string` | `null` | no |
3535
| iam\_user\_emails | A list of IAM users to be created in your cluster | `list(string)` | `[]` | no |
3636
| insights\_config | The insights\_config settings for the database. | <pre>object({<br> query_string_length = number<br> record_application_tags = bool<br> record_client_address = bool<br> })</pre> | `null` | no |
37-
| ip\_configuration | The ip configuration for the master instances. | <pre>object({<br> authorized_networks = list(map(string))<br> ipv4_enabled = bool<br> private_network = string<br> require_ssl = bool<br> allocated_ip_range = string<br> })</pre> | <pre>{<br> "allocated_ip_range": null,<br> "authorized_networks": [],<br> "ipv4_enabled": true,<br> "private_network": null,<br> "require_ssl": null<br>}</pre> | no |
37+
| ip\_configuration | The ip configuration for the master instances. | <pre>object({<br> authorized_networks = list(map(string))<br> ipv4_enabled = bool<br> private_network = string<br> require_ssl = bool<br> allocated_ip_range = string<br> enable_private_path_for_google_cloud_services = optional(bool)<br> })</pre> | <pre>{<br> "allocated_ip_range": null,<br> "authorized_networks": [],<br> "enable_private_path_for_google_cloud_services": false,<br> "ipv4_enabled": true,<br> "private_network": null,<br> "require_ssl": null<br>}</pre> | no |
3838
| maintenance\_window\_day | The day of week (1-7) for the master instance maintenance. | `number` | `1` | no |
3939
| maintenance\_window\_hour | The hour of day (0-23) maintenance window for the master instance maintenance. | `number` | `23` | no |
4040
| maintenance\_window\_update\_track | The update track of maintenance window for the master instance maintenance.Can be either `canary` or `stable`. | `string` | `"canary"` | no |

modules/postgresql/main.tf

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,11 @@ resource "google_sql_database_instance" "default" {
8989
dynamic "ip_configuration" {
9090
for_each = [local.ip_configurations[local.ip_configuration_enabled ? "enabled" : "disabled"]]
9191
content {
92-
ipv4_enabled = lookup(ip_configuration.value, "ipv4_enabled", null)
93-
private_network = lookup(ip_configuration.value, "private_network", null)
94-
require_ssl = lookup(ip_configuration.value, "require_ssl", null)
95-
allocated_ip_range = lookup(ip_configuration.value, "allocated_ip_range", null)
92+
ipv4_enabled = lookup(ip_configuration.value, "ipv4_enabled", null)
93+
private_network = lookup(ip_configuration.value, "private_network", null)
94+
require_ssl = lookup(ip_configuration.value, "require_ssl", null)
95+
allocated_ip_range = lookup(ip_configuration.value, "allocated_ip_range", null)
96+
enable_private_path_for_google_cloud_services = lookup(ip_configuration.value, "enable_private_path_for_google_cloud_services", false)
9697

9798
dynamic "authorized_networks" {
9899
for_each = lookup(ip_configuration.value, "authorized_networks", [])

modules/postgresql/metadata.yaml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ spec:
2323
source:
2424
repo: https://github.com/terraform-google-modules/terraform-google-sql-db
2525
sourceType: git
26-
version: 13.0.1
26+
version: 14.1.0
2727
actuationTool:
2828
type: Terraform
29-
version: '>= 0.13'
29+
version: '>= 1.3'
3030
examples:
3131
- name: mssql-public
3232
location: examples/mssql-public
@@ -101,7 +101,7 @@ spec:
101101
- name: create_timeout
102102
description: The optional timout that is applied to limit long database creates.
103103
type: string
104-
default: 15m
104+
default: 30m
105105
required: false
106106
- name: database_deletion_policy
107107
description: 'The deletion policy for the database. Setting ABANDON allows the resource to be abandoned rather than deleted. This is useful for Postgres, where databases cannot be deleted from the API if there are users other than cloudsqlsuperuser with access. Possible values are: "ABANDON".'
@@ -138,7 +138,7 @@ spec:
138138
- name: delete_timeout
139139
description: The optional timout that is applied to limit long database deletes.
140140
type: string
141-
default: 15m
141+
default: 30m
142142
required: false
143143
- name: deletion_protection
144144
description: Used to block Terraform from deleting a SQL Instance.
@@ -190,6 +190,11 @@ spec:
190190
type: bool
191191
default: true
192192
required: false
193+
- name: enable_random_password_special
194+
description: Enable special characters in generated random passwords.
195+
type: bool
196+
default: false
197+
required: false
193198
- name: encryption_key_name
194199
description: The full path to the encryption key used for the CMEK disk encryption
195200
type: string
@@ -216,15 +221,17 @@ spec:
216221
description: The ip configuration for the master instances.
217222
type: |-
218223
object({
219-
authorized_networks = list(map(string))
220-
ipv4_enabled = bool
221-
private_network = string
222-
require_ssl = bool
223-
allocated_ip_range = string
224+
authorized_networks = list(map(string))
225+
ipv4_enabled = bool
226+
private_network = string
227+
require_ssl = bool
228+
allocated_ip_range = string
229+
enable_private_path_for_google_cloud_services = optional(bool)
224230
})
225231
default:
226232
allocated_ip_range: null
227233
authorized_networks: []
234+
enable_private_path_for_google_cloud_services: false
228235
ipv4_enabled: true
229236
private_network: null
230237
require_ssl: null
@@ -334,7 +341,7 @@ spec:
334341
- name: update_timeout
335342
description: The optional timout that is applied to limit long database updates.
336343
type: string
337-
default: 15m
344+
default: 30m
338345
required: false
339346
- name: user_deletion_policy
340347
description: 'The deletion policy for the user. Setting ABANDON allows the resource to be abandoned rather than deleted. This is useful for Postgres, where users cannot be deleted from the API if they have been granted SQL roles. Possible values are: "ABANDON".'

modules/postgresql/variables.tf

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -209,18 +209,20 @@ variable "password_validation_policy_config" {
209209
variable "ip_configuration" {
210210
description = "The ip configuration for the master instances."
211211
type = object({
212-
authorized_networks = list(map(string))
213-
ipv4_enabled = bool
214-
private_network = string
215-
require_ssl = bool
216-
allocated_ip_range = string
212+
authorized_networks = list(map(string))
213+
ipv4_enabled = bool
214+
private_network = string
215+
require_ssl = bool
216+
allocated_ip_range = string
217+
enable_private_path_for_google_cloud_services = optional(bool)
217218
})
218219
default = {
219-
authorized_networks = []
220-
ipv4_enabled = true
221-
private_network = null
222-
require_ssl = null
223-
allocated_ip_range = null
220+
authorized_networks = []
221+
ipv4_enabled = true
222+
private_network = null
223+
require_ssl = null
224+
allocated_ip_range = null
225+
enable_private_path_for_google_cloud_services = false
224226
}
225227
}
226228

modules/private_service_access/metadata.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ spec:
2323
source:
2424
repo: https://github.com/terraform-google-modules/terraform-google-sql-db
2525
sourceType: git
26-
version: 13.0.1
26+
version: 14.1.0
2727
actuationTool:
2828
type: Terraform
2929
version: '>= 0.13'

0 commit comments

Comments
 (0)