Skip to content

Commit

Permalink
Fix: Fix issue with replica state key and random IDs (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dev25 committed Aug 26, 2020
1 parent 76244bd commit 71b51fd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions docs/upgrading_to_sql_db_4.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ The new `read_replicas` variable is used to manage all replica configuration. In

- You must have `read_replica_size` objects inside `read_replicas`
- You must use the full `zone` id which includes the region e.g. `europe-west1-c` instead of `c`
- You must not have used `random_instance_name`

**Important:** If you have enabled `random_instance_name` then you will need to manually migrate state because the migration script and module does not include the random string as part of the replica state key.

```diff
module "test" {
Expand Down
2 changes: 1 addition & 1 deletion modules/mysql/read_replica.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

locals {
replicas = {
for x in var.read_replicas : "${local.master_instance_name}-replica${var.read_replica_name_suffix}${x.name}" => x
for x in var.read_replicas : "${var.name}-replica${var.read_replica_name_suffix}${x.name}" => x
}
}

Expand Down
2 changes: 1 addition & 1 deletion modules/postgresql/read_replica.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

locals {
replicas = {
for x in var.read_replicas : "${local.master_instance_name}-replica${var.read_replica_name_suffix}${x.name}" => x
for x in var.read_replicas : "${var.name}-replica${var.read_replica_name_suffix}${x.name}" => x
}
}

Expand Down

0 comments on commit 71b51fd

Please sign in to comment.