Loading...
Loading...
### Terraform Version ```shell 1.5.6 ``` ### Terraform Configuration Files main.tf ```terraform terraform { required_version = ">=1.5.6,<1.6" required_providers { snowflake = { source = "snowflake-labs/snowflake" version = ">=0.69.0,<=0.70" } } } provider "snowflake" { alias = "account" account = "mock_account" role = "SYSADMIN" } provider "snowflake" { alias = "sys" account = "mock_account" role = "SYSADMIN" } provider "snowflake" { alias = "security" account = "mock_account" role = "SECURITYADMIN" } module "module_a_impl" { source = "./module_a" providers = { snowflake.security=snowflake.security snowflake.sys=snowflake.sys snowflake.account=snowflake.account } roles = var.roles } variable "roles" { type = list(string) } ``` module_a/main.tf ```terraform terraform { required_providers { snowflake = { source = "snowflake-labs/snowflake" configuration_aliases = [snowflake.security, snowflake.sys, snowflake.account] } } } resource "snowflake_database" "mock_database" { name = "MOCK_DATABASE" provider = snowflake.sys } resource "snowflake_role" "mock_role" { name = "MOCK_ROLE" provider = snowflake.security # Do something wrong. lifecycle { repalce_triggered_by="0" } } module "module_b_impl" { source = "../module_b" providers = { snowflake.security=snowflake.security snowflake.sys=snowflake.sys snowflake.account=snowflake.account } roles = var.roles } variable "roles" { type = list(string) } ``` module_b/main.tf ```terraform terraform { required_providers { snowflake = { source = "snowflake-labs/snowflake" configuration_aliases = [snowflake.security, snowflake.sys, snowflake.account] } } } resource "snowflake_database" "mock_database" { name = "MOCK_DATABASE" provider = snowflake.sys } resource "snowflake_role" "mock_role" { name = "MOCK_ROLE" provider = snowflake.security } variable "roles" { type = list(string) } ``` ### Debug Output https://gist.github.com/DustinMoriarty/b2c68ab3352435182fb4b369cebf68ec ### Expected Behavior I expect to see the most relevant error about the actual cause of the problem: Error: Unsupported argument on module_a/main.tf line 20, in resource "snowflake_role" "mock_role": 20: repalce_triggered_by="0" An argument named "repalce_triggered_by" is not expected here. Did you mean "replace_triggered_by"? ### Actual Behavior The error is buried in many misleading errors about provider type mismatch. The providers are just fine and the command works without errors once I address the actual problem related to the lifecycle block. ### Steps to Reproduce terraform init ### Additional Context This problem is amplified as the terraform configuration get's more complex. With more modules, more providers and more nesting of modules the actual cause is buried in a very large number of misleading errors. I kept the example simple to make it easy to reproduce. However, if you add more modules and providers you will see how bad it can be for a user experience. I consider myself to be a pretty advanced terraform user. However, this problem has been popping up for us periodically for months before I finally understood that the providers have absolutely nothing to do with these errors. Our less experienced terraform users would have zero chance of figuring out the true cause of these errors. ### References _No response_
Click on a version to see all relevant bugs
Terraform Integration
Learn more about where this data comes from
Bug Scrub Advisor
Streamline upgrades with automated vendor bug scrubs
BugZero Enterprise
Wish you caught this bug sooner? Get proactive today.