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

Add START WITH optional value to Sequence Resource

Open chriscorbin opened this issue 1 year ago • 2 comments

Terraform CLI and Provider Versions

Terraform v1.5.7 on darwin_arm64

  • provider registry.terraform.io/snowflake-labs/snowflake v0.85.0

Your version of Terraform is out of date! The latest version is 1.7.4. You can update by downloading from https://www.terraform.io/downloads.html

Use Cases or Problem Statement

The sequence resource does not currently support a custom starting value that could be like one would normally use with the START [WITH] parameter when executing the CREATE or ALTER SEQUENCE DDL referenced in Snowflake's Documentation

This would greatly assist in the migration of existing snowflake resources into Terraform.

Proposal

A start with value be added to the sequence resource, syntax is dealers choice but, a suggestion would be:

resource "snowflake_sequence" "test_sequence" {
  database = snowflake_database.test_database.name
  schema   = snowflake_schema.test_schema.name
  name     = "thing_counter"
  starts_with = 10000
}

How much impact is this issue causing?

Medium

Additional Information

Current workaround is to implement the sequence resource as-is and then assume a break-fix role to manually increment the sequence, this isn't ideal but will do the trick in the short-term.

chriscorbin avatar Mar 05 '24 15:03 chriscorbin

Hey @chriscorbin. Thanks for reporting the issue.

We are currently in the process of redesigning all existing resources (and adding missing functionalities too) as part of https://github.com/Snowflake-Labs/terraform-provider-snowflake/blob/main/ROADMAP.md#supporting-all-snowflake-ga-features. We will keep this issue in mind while working on the sequence resource.

sfc-gh-asawicki avatar Mar 06 '24 08:03 sfc-gh-asawicki

+1 for this issue. This is a real shortcoming trying to create/maintain Snowflake infra via Terraform given the pivotal role of the sequence. Any update on when this fix will be available? @chriscorbin with respect to your workaround note the SF documentation says that "the first/initial value cannot be altered after the sequence is created". Can you provide details on your workaround method? TIA

finn-O avatar Apr 04 '24 14:04 finn-O