Terraform import failing for postgres provider

Hi I’m importing a resource but it’s failing. I’m not sure what the issue is. Can someone point me how to fix this error.

Terraform v0.12.20

  • provider.aws v2.58.0
  • provider.postgresql v1.5.0

Your version of Terraform is out of date! The latest version

My module:
locals.tf:

pgauth_dbs = var.env == "prod" ? var.amp_pgauth_prod_dbs : var.amp_pgauth_stage_dbs

variables.tf

variable "amp_pgauth_stage_dbs" {
  type    = list(string)
  default = ["host_configs, "staging", "staging_preview"]
}

Provider

provider "postgresql" {
  alias            = "pg1"
  host             = aws_db_instance.name.address
  username         = var.username
  password         = var.master_password
  expected_version = "11.5" 
  sslmode          = "disable"
  connect_timeout  = 15
}

module:

 resource "postgresql_database" "pgauth_dbs" {
  provider = postgresql.pg1
  for_each = toset(local.pgauth_dbs)
  name     = each.value
  owner    = "postgres"
}

terraform import module.rds.postgresql_database.name_dbs[“host_configs”] host_configs

module.rds.postgresql_database.name_dbs[“host_configs”]: Importing from ID “host_configs”…
module.rds.postgresql_database.name_dbs[“host_configs”]: Import prepared!
Prepared postgresql_database for import
module.rds.postgresql_database.name_dbs[“host_configs”]: Refreshing state… [id=host_configs]

Error: could not start transaction: pq: no PostgreSQL user name specified in startup packet