terraform-provider-snowflake icon indicating copy to clipboard operation
terraform-provider-snowflake copied to clipboard

[Bug]: Alter Snowflake tables using Terraform

Open sumitbourne opened this issue 1 year ago • 1 comments

Terraform CLI Version

1.6.0

Terraform Provider Version

1.6.0

Company Name

No response

Terraform Configuration

We are creating the tables, views and Snowpipe in Snowflake using Terraform code. However we are unable to alter the tables or views or Snowpipe. To alter the resources in the Snowflake, we require to drop the objects and recreate it in Terraform. Can you suggest any other ways to alter the resources without dropping in the Snowflake  through terraform.

Category

category:resource

Object type(s)

No response

Expected Behavior

It should alter table using Terraform code.

Actual Behavior

When we change the datatype through terraform, it is not altering the table in the snowflake. We need to drop the table and recreate it.

Steps to Reproduce

  1. Create the snowflake table using terraform code.
  2. Then change the datatype of any column after creation of table in snowflake

How much impact is this issue causing?

Low

Logs

No response

Additional Information

No response

Would you like to implement a fix?

  • [ ] Yeah, I'll take it 😎

sumitbourne avatar Jan 08 '25 05:01 sumitbourne

Hey @sumitbourne. Thanks for reaching out to us.

The table resource is still a preview resource. We will address it with the rework (together with other table problems: https://github.com/Snowflake-Labs/terraform-provider-snowflake/labels/resource%3Atable).

One remark here, though. Using ALTER TABLE to change the data type has limitations on its own; you can change type only to the synonym type, and changing to other types will still require recreation (read more here: https://docs.snowflake.com/en/sql-reference/sql/alter-table-column).

sfc-gh-asawicki avatar Jan 08 '25 09:01 sfc-gh-asawicki