I have made a change to a terraform module to use a different version of a module source:
module "resources" {
providers = {
snowflake.sys = snowflake.sys
snowflake.sec = snowflake.sec
}
- source = "git::https://github.com/org/repo//terraform/modules/foo?ref=bar"
+ source = "git::https://github.com/org/repo//terraform/modules/foo?ref=baz"
...
...
}
When running terraform plan
I got error
╷
│ Error: Provider type mismatch
│
│ on resources.tf line 41, in module "resources":
│ 41: snowflake.sys = snowflake.sys
│
│ The local name "snowflake.sys" in the root module represents provider
│ "hashicorp/snowflake", but "snowflake.sys" in module.resources represents
│ "snowflake-labs/snowflake".
│
│ Each provider has its own distinct configuration schema and provider types,
│ so this module`s "snowflake.sys" can be assigned only a configuration for
│ snowflake-labs/snowflake, which is not required by module.resources.
╵
This is very confusing to me. snowflake.sys in the root module is defined like so:
terraform {
required_version = ">= 0.13"
required_providers {
snowflake = {
source = "snowflake-labs/snowflake"
version = "0.83.1"
}
vault = {
source = "hashicorp/vault"
version = "~> 3.0"
}
}
}
provider "vault" {
namespace = "redacted"
}
data "vault_generic_secret" "vault_secrets_automation" {
path = format("common/key-value/path/to/secret")
}
provider "snowflake" {
user = "user@example.com"
alias = "sys"
account = "xyz"
private_key = data.vault_generic_secret.vault_secrets_automation.data["key"]
role = "SYSADMIN"
authenticator = "JWT"
}
As you can see I am using provider “snowflake-labs/snowflake” so I am confused by the error message:
The local name “snowflake.sys” in the root module represents provider “hashicorp/snowflake”
Can someone please explain to me why I’m getting this error because I simply don’t understand it.