Snowflake-Labs / terraform-provider-snowflake

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

Add `ENABLE_SCHEMA_EVOLUTION` flag for `snowflake_table` resource. #2676

Open RenanBasilio opened 5 months ago

RenanBasilio commented 5 months ago

Terraform CLI and Provider Versions

Terraform: 1.7.4 Provider: 0.87.2

Use Cases or Problem Statement

Our company maintains snowpipes and their target tables via the snowflake terraform provider. Some of these pipelines including evolving schemas, and we'd like to use Snowflake's built in schema evolution features to handle this.

This means we often have to create the tables via terraform and then subsequently run an ALTER TABLE statement in Snowflake in order to enable schema evolution, or skip using terraform for those tables entirely.

Proposal

The provider should support setting the property enable_schema_evolution during table creation.

The table should be initialized by terraform with the initial column configuration provided and with the enable_schema_evolution flag set.

This flag being set should also set the lifecycle rule to ignore changes to nested column attributes, as these may be added or modified externally by Snowflake schema evolution. This last step could be done either implicitly or explicitly.

How much impact is this issue causing?

Medium

Additional Information

No response

sfc-gh-asawicki commented 5 months ago

Hey @RenanBasilio. Thanks for reaching out to us.

Have you considered using https://developer.hashicorp.com/terraform/language/meta-arguments/lifecycle#ignore_changes?

RenanBasilio commented 5 months ago

The issue isn't with the inability to ignore changes, so much so as the option to enable schema evolution not being available when creating the table via the provider.

sfc-gh-asawicki commented 5 months ago

We will support the missing param as part of https://github.com/Snowflake-Labs/terraform-provider-snowflake/blob/main/ROADMAP.md#supporting-all-snowflake-ga-features. I will share a more concrete ordering of resources we will tackle in the next two weeks.