selectel / terraform-provider-selectel

Terraform Selectel provider
https://www.terraform.io/docs/providers/selectel/
Mozilla Public License 2.0
42 stars 32 forks source link

DBaaS PosgresSQL requires apply twice to update `datastore.connections` #302

Open legioner0 opened 1 week ago

legioner0 commented 1 week ago

I have selectel_dbaas_postgresql_datastore_v1 cluster with node_count==1, filled with data (~12Gb). For some reason I had to increase node_count to 2. After terraform apply, that took 11 minutes, I've found that datastore.connections contains only master node without replica. Only after second terraform apply, replica appeared in datastore.connections.

Terraform Version

Terraform v1.9.7

Terraform Provider Selectel Version

5.4.0

Affected Resource(s)

Terraform Configuration Files

resource "selectel_dbaas_postgresql_datastore_v1" "datastore" {
    name        = "test1"
    node_count  = 1
    project_id  = "<sensitive value>"
    region      = "ru-2"
    subnet_id   = "<...>"
    type_id     = "b15e73d3-e585-4b6c-bc95-0b698de8f771" # PostgreSQL 14

    flavor {
        disk  = 32
        ram   = 4096
        vcpus = 1
       }

    pooler {
        mode = "transaction"
        size = 50
       }
   }

Expected Behavior

datastore.connections updated (add replica) on first terraform apply

Actual Behavior

datastore.connections not updated of first terraform apply

Steps to Reproduce

  1. terraform apply
  2. fill database with data
  3. increase node_count
  4. terraform apply - datastore.connections not updated
  5. terraform apply - datastore.connections updated correctly
legioner0 commented 1 week ago

Ok, this problem is not related to size of data in DB - datastore.connections not updated on plan stage. So step to reproduce:

  1. terraform apply - datastore.connections not updated
  2. terraform apply - datastore.connections updated correctly