╷
│ 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:
I’m not sure what’s going on there, does the terraform providers output give you any more information?
The only thing I can see is that you have a typo in your terraform block, which is missing a closing brace. That would normally cause parsing errors like Unclosed configuration block though, but maybe it’s related somehow.
Hi @jbardin ,
The typo was my fault. I copied the entirety of our terraform.tf file then removed the parts that were irrelevant for this question. I clearly made a mistake and removed one brace too many. I’ve now added it back the message above.
I ran terraform providers and got the same error message as above. However, I switched back to branch main in my repo, ran terraform providers again, and again got the same errors. This suggests that the cause of this error is not the change that I made in my branch.
│ The local name “snowflake.sys_admin” in the root module represents provider
│ “snowflake-labs/snowflake”, but “snowflake.sys_admin” in module.default
│ represents “hashicorp/snowflake”.
@jbardin Thanks for checking in. I have added the Updated section in the same comment and it is already resolved for me. Basically seems like custom providers like Snowflake which is not officially listed under hashicorp doesnot automatically pass the provider context to child modules. Even if I don’t have any alias and just a single snowflake provider, I must repeat the required_providers block in child modules.
Thx for the explanation @stntmaniiac . After originally posting this thread I discovered the same, I had to add required_providers in module source. Apologies for not coming back here and updating accordingly.