|
| 1 | +# Upgrading to SQL DB 12.0.0 |
| 2 | + |
| 3 | +The 12.0.0 release of SQL DB is a backward incompatible release. This incompatibility affects configuration of read replicas for `mysql`, `postgresql` and `safer_mysql` submodules. |
| 4 | + |
| 5 | +## Migration Instructions |
| 6 | + |
| 7 | +### Add support for setting availability_type |
| 8 | + |
| 9 | +Prior to the 12.0.0 release, all read replicas were created using the default availability type set to `ZONAL`. The addition of `availability_type` allows explicit setting of availability type for each read replica. |
| 10 | + |
| 11 | +```hcl |
| 12 | +module "pg" { |
| 13 | + source = "GoogleCloudPlatform/sql-db/google//modules/postgresql" |
| 14 | + version = "~> 11.0" |
| 15 | +
|
| 16 | + project_id = var.project_id |
| 17 | + region = "europe-west1" |
| 18 | + zone = "europe-west1-d" |
| 19 | + name = "test" |
| 20 | + random_instance_name = true |
| 21 | + availability_type = "ZONAL" |
| 22 | + database_version = "POSTGRES_14" |
| 23 | + disk_type = "PD_HDD" |
| 24 | + disk_size = 10 |
| 25 | + disk_autoresize = true |
| 26 | + create_timeout = "30m" |
| 27 | +
|
| 28 | + read_replicas = [ |
| 29 | + { |
| 30 | + name = "0" |
| 31 | + zone = "europe-west1-d" |
| 32 | + tier = "db-f1-micro" |
| 33 | + disk_type = "PD_HDD" |
| 34 | + disk_size = 10 |
| 35 | + disk_autoresize = true |
| 36 | + disk_autoresize_limit = 0 |
| 37 | + encryption_key_name = null |
| 38 | + database_flags = [] |
| 39 | + user_labels = {} |
| 40 | +
|
| 41 | + ip_configuration = { |
| 42 | + allocated_ip_range = null |
| 43 | + authorized_networks = [] |
| 44 | + ipv4_enabled = true |
| 45 | + private_network = null |
| 46 | + require_ssl = false |
| 47 | + } |
| 48 | + }, |
| 49 | + ] |
| 50 | +} |
| 51 | +``` |
| 52 | + |
| 53 | +With the 12.0.0 release, the `availability_type` string variable is presented which allows users to set the availability type of their read replicas as `ZONAL` or `REGIONAL`. |
| 54 | + |
| 55 | +```diff |
| 56 | +module "pg" { |
| 57 | + source = "GoogleCloudPlatform/sql-db/google//modules/postgresql" |
| 58 | +- version = "~> 11.0" |
| 59 | ++ version = "~> 12.0" |
| 60 | + |
| 61 | + project_id = var.project_id |
| 62 | + region = "europe-west1" |
| 63 | + zone = "europe-west1-d" |
| 64 | + name = "test" |
| 65 | + random_instance_name = true |
| 66 | + availability_type = "ZONAL" |
| 67 | + database_version = "POSTGRES_14" |
| 68 | + disk_type = "PD_HDD" |
| 69 | + disk_size = 10 |
| 70 | + disk_autoresize = true |
| 71 | + create_timeout = "30m" |
| 72 | + |
| 73 | + read_replicas = [ |
| 74 | + { |
| 75 | + name = "0" |
| 76 | + zone = "europe-west1-d" |
| 77 | + tier = "db-f1-micro" |
| 78 | + disk_type = "PD_HDD" |
| 79 | + disk_size = 10 |
| 80 | + disk_autoresize = true |
| 81 | ++ availability_type = "ZONAL" |
| 82 | + disk_autoresize_limit = 0 |
| 83 | + encryption_key_name = null |
| 84 | + database_flags = [] |
| 85 | + user_labels = {} |
| 86 | + |
| 87 | + ip_configuration = { |
| 88 | + allocated_ip_range = null |
| 89 | + authorized_networks = [] |
| 90 | + ipv4_enabled = true |
| 91 | + private_network = null |
| 92 | + require_ssl = false |
| 93 | + } |
| 94 | + }, |
| 95 | + ] |
| 96 | +} |
| 97 | +``` |
0 commit comments