Skip to content

Commit

Permalink
feat!: Adds secondary_zone to db modules
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiezieziula committed Oct 21, 2022
1 parent 8a84192 commit 7818a7e
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 5 deletions.
1 change: 1 addition & 0 deletions modules/mssql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ The following dependency must be available for SQL Server module:
| random\_instance\_name | Sets random suffix at the end of the Cloud SQL resource name | `bool` | `false` | no |
| region | The region of the Cloud SQL resources | `string` | `"us-central1"` | no |
| root\_password | MSSERVER password for the root user. If not set, a random one will be generated and available in the root\_password output variable. | `string` | `""` | no |
| secondary\_zone | The preferred zone for the secondary/failover instance, it should be something like: `us-central1-a`, `us-east1-c`. | `string` | `null` | no |
| sql\_server\_audit\_config | SQL server audit config settings. | `map(string)` | `{}` | no |
| tier | The tier for the master instance. | `string` | `"db-custom-2-3840"` | no |
| update\_timeout | The optional timeout that is applied to limit long database updates. | `string` | `"15m"` | no |
Expand Down
3 changes: 2 additions & 1 deletion modules/mssql/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ resource "google_sql_database_instance" "default" {
user_labels = var.user_labels

location_preference {
zone = var.zone
zone = var.zone
secondary_zone = var.secondary_zone
}

maintenance_window {
Expand Down
6 changes: 6 additions & 0 deletions modules/mssql/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ variable "zone" {
default = "us-central1-a"
}

variable "secondary_zone" {
type = string
description = "The preferred zone for the secondary/failover instance, it should be something like: `us-central1-a`, `us-east1-c`."
default = null
}

variable "activation_policy" {
description = "The activation policy for the master instance.Can be either `ALWAYS`, `NEVER` or `ON_DEMAND`."
type = string
Expand Down
1 change: 1 addition & 0 deletions modules/mysql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Note: CloudSQL provides [disk autoresize](https://cloud.google.com/sql/docs/mysq
| read\_replica\_name\_suffix | The optional suffix to add to the read instance name | `string` | `""` | no |
| 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> tier = string<br> zone = string<br> availability_type = string<br> disk_type = string<br> disk_autoresize = bool<br> disk_autoresize_limit = number<br> disk_size = string<br> user_labels = map(string)<br> database_flags = list(object({<br> name = string<br> value = string<br> }))<br> ip_configuration = 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> })<br> encryption_key_name = string<br> }))</pre> | `[]` | no |
| region | The region of the Cloud SQL resources | `string` | `"us-central1"` | no |
| secondary\_zone | The preferred zone for the secondary/failover instance, it should be something like: `us-central1-a`, `us-east1-c`. | `string` | `null` | no |
| tier | The tier for the master instance. | `string` | `"db-n1-standard-1"` | no |
| update\_timeout | The optional timout that is applied to limit long database updates. | `string` | `"10m"` | no |
| user\_host | The host for the default user | `string` | `"%"` | no |
Expand Down
3 changes: 2 additions & 1 deletion modules/mysql/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ resource "google_sql_database_instance" "default" {
}

location_preference {
zone = var.zone
zone = var.zone
secondary_zone = var.secondary_zone
}

maintenance_window {
Expand Down
6 changes: 6 additions & 0 deletions modules/mysql/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ variable "zone" {
type = string
}

variable "secondary_zone" {
type = string
description = "The preferred zone for the secondary/failover instance, it should be something like: `us-central1-a`, `us-east1-c`."
default = null
}

variable "activation_policy" {
description = "The activation policy for the master instance. Can be either `ALWAYS`, `NEVER` or `ON_DEMAND`."
type = string
Expand Down
2 changes: 1 addition & 1 deletion modules/mysql/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ terraform {
}
google = {
source = "hashicorp/google"
version = ">= 4.4.0, < 5.0"
version = ">= 4.28.0, < 5.0"
}
google-beta = {
source = "hashicorp/google-beta"
Expand Down
1 change: 1 addition & 0 deletions modules/postgresql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Note: CloudSQL provides [disk autoresize](https://cloud.google.com/sql/docs/mysq
| read\_replica\_name\_suffix | The optional suffix to add to the read instance name | `string` | `""` | no |
| 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> tier = string<br> availability_type = string<br> zone = string<br> disk_type = string<br> disk_autoresize = bool<br> disk_autoresize_limit = number<br> disk_size = string<br> user_labels = map(string)<br> database_flags = list(object({<br> name = string<br> value = string<br> }))<br> ip_configuration = 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> })<br> encryption_key_name = string<br> }))</pre> | `[]` | no |
| region | The region of the Cloud SQL resources | `string` | `"us-central1"` | no |
| secondary\_zone | The preferred zone for the secondary/failover instance, it should be something like: `us-central1-a`, `us-east1-c`. | `string` | `null` | no |
| tier | The tier for the master instance. | `string` | `"db-f1-micro"` | no |
| update\_timeout | The optional timout that is applied to limit long database updates. | `string` | `"15m"` | no |
| user\_labels | The key/value labels for the master instances. | `map(string)` | `{}` | no |
Expand Down
3 changes: 2 additions & 1 deletion modules/postgresql/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ resource "google_sql_database_instance" "default" {
user_labels = var.user_labels

location_preference {
zone = var.zone
zone = var.zone
secondary_zone = var.secondary_zone
}

maintenance_window {
Expand Down
6 changes: 6 additions & 0 deletions modules/postgresql/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ variable "zone" {
description = "The zone for the master instance, it should be something like: `us-central1-a`, `us-east1-c`."
}

variable "secondary_zone" {
type = string
description = "The preferred zone for the secondary/failover instance, it should be something like: `us-central1-a`, `us-east1-c`."
default = null
}

variable "activation_policy" {
description = "The activation policy for the master instance.Can be either `ALWAYS`, `NEVER` or `ON_DEMAND`."
type = string
Expand Down
2 changes: 1 addition & 1 deletion modules/postgresql/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ terraform {
}
google = {
source = "hashicorp/google"
version = ">= 4.4.0, < 5.0"
version = ">= 4.28.0, < 5.0"
}
google-beta = {
source = "hashicorp/google-beta"
Expand Down

0 comments on commit 7818a7e

Please sign in to comment.