Skip to content

Commit be2da56

Browse files
feat(postgres): add root password parameter (#521)
Co-authored-by: Awais Malik <[email protected]>
1 parent 1e4b541 commit be2da56

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

modules/postgresql/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ Note: CloudSQL provides [disk autoresize](https://cloud.google.com/sql/docs/mysq
5252
| read\_replica\_name\_suffix | The optional suffix to add to the read instance name | `string` | `""` | no |
5353
| read\_replicas | List of read replicas to create. Encryption key is required for replica in different region. For replica in same region as master set encryption\_key\_name = null | <pre>list(object({<br> name = string<br> name_override = optional(string)<br> tier = optional(string)<br> edition = optional(string)<br> availability_type = optional(string)<br> zone = optional(string)<br> disk_type = optional(string)<br> disk_autoresize = optional(bool)<br> disk_autoresize_limit = optional(number)<br> disk_size = optional(string)<br> user_labels = map(string)<br> database_flags = optional(list(object({<br> name = string<br> value = string<br> })), [])<br> insights_config = optional(object({<br> query_plans_per_minute = optional(number, 5)<br> query_string_length = optional(number, 1024)<br> record_application_tags = optional(bool, false)<br> record_client_address = optional(bool, false)<br> }), null)<br> ip_configuration = object({<br> authorized_networks = optional(list(map(string)), [])<br> ipv4_enabled = optional(bool)<br> private_network = optional(string, )<br> require_ssl = optional(bool)<br> ssl_mode = optional(string)<br> allocated_ip_range = optional(string)<br> enable_private_path_for_google_cloud_services = optional(bool, false)<br> psc_enabled = optional(bool, false)<br> psc_allowed_consumer_projects = optional(list(string), [])<br> })<br> encryption_key_name = optional(string)<br> }))</pre> | `[]` | no |
5454
| region | The region of the Cloud SQL resources | `string` | `"us-central1"` | no |
55+
| root\_password | Initial root password during creation | `string` | `null` | no |
5556
| secondary\_zone | The preferred zone for the secondary/failover instance, it should be something like: `us-central1-a`, `us-east1-c`. | `string` | `null` | no |
5657
| tier | The tier for the master instance. | `string` | `"db-f1-micro"` | no |
5758
| update\_timeout | The optional timout that is applied to limit long database updates. | `string` | `"30m"` | no |

modules/postgresql/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ resource "google_sql_database_instance" "default" {
5858
region = var.region
5959
encryption_key_name = var.encryption_key_name
6060
deletion_protection = var.deletion_protection
61+
root_password = var.root_password
6162

6263
settings {
6364
tier = var.tier

modules/postgresql/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,12 @@ variable "connector_enforcement" {
416416
default = false
417417
}
418418

419+
variable "root_password" {
420+
description = "Initial root password during creation"
421+
type = string
422+
default = null
423+
}
424+
419425
variable "data_cache_enabled" {
420426
description = "Whether data cache is enabled for the instance. Defaults to false. Feature is only available for ENTERPRISE_PLUS tier and supported database_versions"
421427
type = bool

0 commit comments

Comments
 (0)