-
I'm on tofu 1.9.1 and no matter what I try i always get the error This reduced example config will fail during provider config: terraform {
required_version = "~> 1.9.0"
required_providers {
postgresql = {
source = "cyrilgdn/postgresql"
version = "1.25.0"
}
}
}
provider "postgresql" {
alias = "by_db"
for_each = toset(["a","b","c"])
host = "test.test"
port = 5432
database = "test"
username = "test"
password = each.key
sslmode = "require"
connect_timeout = 15
} referencing the provider: resource "postgresql_schema" "test" {
for_each = toset(["a","b","c"])
provider = postgres.by_db[each.key]
name = each.key
owner = "test"
} tf init output:
There must be something obvious I'm doing wrong here but I can't find the mistake even after staring at the documentation. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi, there is a typo in: resource "postgresql_schema" "test" {
for_each = toset(["a","b","c"])
provider = postgres.by_db[each.key]
name = each.key
owner = "test"
} Replace |
Beta Was this translation helpful? Give feedback.
Hi, there is a typo in:
Replace
provider = postgres.by_db[each.key]
with
provider = postgresql.by_db[each.key]