Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Can only use one of database, schema, or account in snowflake_views in clause #3203

Open
1 task
mpayne-coveo opened this issue Nov 14, 2024 · 2 comments
Labels
general-usage General help/usage questions

Comments

@mpayne-coveo
Copy link

mpayne-coveo commented Nov 14, 2024

Terraform CLI Version

1.9.8

Terraform Provider Version

0.97.0

Company Name

Coveo

Terraform Configuration

data "snowflake_views" "database_schema_views" {
      in {
        database = "DATABASE_ABC"
        schema   = "SCHEMA_XYZ"
      }
}

Category

category:data_source

Object type(s)

No response

Expected Behavior

All views under that schema/database to be returned

Actual Behavior

╷
│ Error: Invalid combination of arguments
│ 
│   with data.snowflake_views.database_schema_views,
│   on snowflake_views.tf line xx, in data "snowflake_views" "database_schema_views":
│  209:     schema   = "SCHEMA_XYZ"
│ 
│ "in.0.schema": only one of `in.0.account,in.0.database,in.0.schema` can be
│ specified, but `in.0.database,in.0.schema` were specified.

Steps to Reproduce

Run terraform plan with the above configuration

How much impact is this issue causing?

Low

Logs

No response

Additional Information

We're in the middle of migrating our Snowflake Terraform provider from 0.93.0 to 0.97.0. In 0.93.0, we were able to specify something like this to return all views under a schema/database-

data "snowflake_views" "database_schema_views" {
      database = "DATABASE_ABC"
      schema   = "SCHEMA_XYZ"
}

According to the migration guide, the behaviour should have been maintained by using the in clause instead. However, when we run a terraform plan, we get the following error-

╷
│ Error: Invalid combination of arguments
│ 
│   with data.snowflake_views.database_schema_views,
│   on snowflake_views.tf line xx, in data "snowflake_views" "database_schema_views":
│  209:     schema   = "SCHEMA_XYZ"
│ 
│ "in.0.schema": only one of `in.0.account,in.0.database,in.0.schema` can be
│ specified, but `in.0.database,in.0.schema` were specified.

How would we be able to maintain the previous behaviour/state?

Would you like to implement a fix?

  • Yeah, I'll take it 😎
@mpayne-coveo mpayne-coveo added the bug Used to mark issues with provider's incorrect behavior label Nov 14, 2024
@sfc-gh-asawicki sfc-gh-asawicki added general-usage General help/usage questions and removed bug Used to mark issues with provider's incorrect behavior labels Nov 15, 2024
@sfc-gh-asawicki
Copy link
Collaborator

Hey @mpayne-coveo. Thanks for reaching out to us.

You have to use a fully qualified name as stated in the docs: https://registry.terraform.io/providers/Snowflake-Labs/snowflake/0.97.0/docs/data-sources/views#nested-schema-for-in. We will add it to the examples.

So in your case, it should be:

data "snowflake_views" "database_schema_views" {
      in {
        schema   = "\"DATABASE_ABC\".\"SCHEMA_XYZ\""
      }
}

If you provision the schema in the same tf deployment, you can use snowflake_schema.<your_schema>.fully_qualified_name (https://registry.terraform.io/providers/Snowflake-Labs/snowflake/0.97.0/docs/resources/schema#fully_qualified_name-1).

@mpayne-coveo
Copy link
Author

Great, thank you! Yes please, adding it as an example in the docs would be helpful here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
general-usage General help/usage questions
Projects
None yet
Development

No branches or pull requests

2 participants