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

Forced modify table when column using sequence nextval as default

Open acakovacevic opened this issue 1 year ago • 1 comments

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

acakovacevic avatar Mar 22 '24 11:03 acakovacevic

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-asawicki avatar Mar 22 '24 12:03 sfc-gh-asawicki

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

sfc-gh-jcieslak avatar Aug 15 '24 10:08 sfc-gh-jcieslak

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 avatar Sep 05 '24 09:09 sfc-gh-jcieslak

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

sfc-gh-jcieslak avatar Oct 15 '24 14:10 sfc-gh-jcieslak