Skip to content

Having a hard time with provider for_each: An instance key can be specified only for a provider configuration that uses for_each. #2804

Answered by yottta
mardonner asked this question in Q&A
Discussion options

You must be logged in to vote

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
provider = postgres.by_db[each.key]
with
provider = postgresql.by_db[each.key]

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@cam72cam
Comment options

@cam72cam
Comment options

@mardonner
Comment options

Answer selected by mardonner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants