Snowflake-Labs / terraform-provider-snowflake

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

Forced modify table when column using sequence nextval as default #2644

Closed acakovacevic closed 3 weeks ago

acakovacevic commented 7 months ago

Terraform CLI and Provider Versions

Terraform v1.6.6

required_providers { snowflake = { source = "Snowflake-Labs/snowflake" version = "0.87.2" }

Terraform Configuration

resource "snowflake_table" "report" {
  name     = "REPORT"
  database = snowflake_database.databases["SFAPPS"].name
  schema   = snowflake_schema.schemas["DYNRPT"].name
  column {
    name     = "ID"
    type     = "NUMBER(38,0)"
    nullable = false

    default {
      sequence = "${snowflake_database.databases["SFAPPS"].name}.${snowflake_schema.schemas["DYNRPT"].name}.REPORT_SEQ"
    }
  }
....

  # snowflake_table.report will be updated in-place
  ~ resource "snowflake_table" "report" {
        id                          = "DEV_SFAPPS|DYNRPT|REPORT"
        name                        = "REPORT"
        # (7 unchanged attributes hidden)

      ~ column {
            name     = "ID"
            # (2 unchanged attributes hidden)

          ~ default {
              ~ sequence = "\"DEV_SFAPPS\".\"DYNRPT\".\"REPORT_SEQ\"" -> "DEV_SFAPPS.DYNRPT.REPORT_SEQ"
            }
        }

        # (15 unchanged blocks hidden)
    }
...
snowflake_table.report: Modifying... [id=DEV_SFAPPS|DYNRPT|REPORT]

Expected Behavior

To not report there is updated in-place when nothing changed

Actual Behavior

terraform apply -> always report there is an updated in-place

Steps to Reproduce

  1. terraform apply

How much impact is this issue causing?

Medium

Logs

No response

Additional Information

It is bug introduced after version 0.84.1

sfc-gh-asawicki commented 7 months ago

Hey @acakovacevic. Thanks for reaching out to us.

The identifiers are a tricky thing. We will address this topic soon as part of: https://github.com/Snowflake-Labs/terraform-provider-snowflake/blob/main/ROADMAP.md#identifiers-rework.

sfc-gh-jcieslak commented 2 months ago

Hey @acakovacevic 👋 Thanks for reporting the issue. This will be fixed in the next release (somewhere around next week).

sfc-gh-jcieslak commented 2 months ago

Hey 👋 Yesterday, we released a new version of the provider (v0.95.0) that shouldn't produce any plans related to quoting. We also prepared a document concluding identifiers rework (here) that should clear things up regarding identifiers.

sfc-gh-jcieslak commented 3 weeks ago

Closing due to long inactivity. Please, create another issue if you think the problem is still not resolved.