Snowflake-Labs / terraform-provider-snowflake

Terraform provider for managing Snowflake accounts
https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest
MIT License
515 stars 404 forks source link

[Bug]: Column names being escaped unnecessarily #2844

Open pbsf opened 1 month ago

pbsf commented 1 month ago

Terraform CLI Version

v1.5.7

Terraform Provider Version

11.3.2

Terraform Configuration

resource "snowflake_table" "table" {
  database                    = snowflake_schema.schema.database
  schema                      = snowflake_schema.schema.name
  name                        = "table"

  column {
    name     = "my'id"
    type     = "int"
    nullable = false
  }
}

Category

category:resource

Object type(s)

resource:table

Expected Behavior

I'd expect the column to be created with the name "my'id".

Actual Behavior

The column is created with the name "my\'id".

Steps to Reproduce

Run terraform apply.

How much impact is this issue causing?

Low

Logs

No response

Additional Information

Since Snowflake allows columns to have ' in it, so should its TF provider.

Would you like to implement a fix?

sfc-gh-asawicki commented 1 month ago

Hey @pbsf. Thanks for reaching out to us.

The table resource will be redesigned shortly as part of https://github.com/Snowflake-Labs/terraform-provider-snowflake/blob/main/ROADMAP.md#preparing-essential-ga-objects-for-the-provider-v1. It has multiple problems (you can check them here: https://github.com/Snowflake-Labs/terraform-provider-snowflake/blob/main/v1-preparations/ESSENTIAL_GA_OBJECTS.MD). I will add this one to the list.

In the meantime, as a workaround: just don't use ' in the column names.

pbsf commented 1 month ago

@sfc-gh-asawicki, thanks for the quick response.

In the meantime, as a workaround: just don't use ' in the column names.

Unfortunately, this is required in my use case: data is being ingested from .csv files into Snowflake, and the .csv headers have ' in them. I've forked this repository and will be using my workaround instead.

I am looking forward to the redesign changes once they are ready.

Thanks for maintaining this project.