Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] snowflake_stage with file_format containing quoted values always shows as modified #1491

Open
justenwalker opened this issue Jan 23, 2023 · 2 comments
Labels
bug Used to mark issues with provider's incorrect behavior category:resource resource:stage Issue connected to the snowflake_stage resource

Comments

@justenwalker
Copy link

Provider Version

0.55.1

Terraform Version

1.3.7

Describe the bug

The file_format parameter of a snowflake_stage will always be modified due to some escape character differences if the input value requires quoting.

Expected behavior

The plan should require no changes since the file_format value did not change.

Code samples and commands

Assuming you've defined a stage like this with a file_format containing quoted values:

 resource "snowflake_stage" "my_stage" {
  name                = "MY_STAGE"
  database            = "MY_DATABASE"
  schema              = "MY_SCHEMA"
  file_format         = "FORMAT_NAME = \"MY_DATABASE\".\"MY_SCHEMA\".\"MY_FILE_FORMAT\""
}

After the initially successful terraform apply, further terraform plans will always have modifications:

  # snowflake_stage.my_stage will be updated in-place
  ~ resource "snowflake_stage" "my_stage" {
      ~ file_format         = "FORMAT_NAME = \\\"MY_DATABASE\\\".\\\"MY_SCHEMA\\\".\\\"MY_FILE_FORMAT\\\"" -> "FORMAT_NAME = \"MY_DATABASE\".\"MY_SCHEMA\".\"MY_FILE_FORMAT\""
        id                  = "MY_DATABASE|MY_SCHEMA|MY_STAGE"
        name                = "MY_STAGE"
        # (6 unchanged attributes hidden)
    }

Additional context

It appears as though the input value is compared with a double-escaped value and so further plans want to remove the extra escaping.

@justenwalker justenwalker added the bug Used to mark issues with provider's incorrect behavior label Jan 23, 2023
@justenwalker justenwalker changed the title [Bug] snoflake_stage with file_format containing quoted values always shows as modified [Bug] snowflake_stage with file_format containing quoted values always shows as modified Jan 23, 2023
@sfc-gh-jcieslak sfc-gh-jcieslak added category:resource resource:stage Issue connected to the snowflake_stage resource labels May 20, 2024
@JohnMav
Copy link

JohnMav commented Oct 24, 2024

Just noting that this issue persists even when using the latest fully_qualified_name in version 0.95.0

i.e.

resource "snowflake_stage" "my_stage" {
  name      = "MY_STAGE"
  file_format = "FORMAT_NAME = ${snowflake_file_format.my_format.fully_qualified_name}"
  database  = snowflake_database.my_database.name
  schema    = snowflake_schema.my_schema.name
}

Results in:

  # snowflake_stage.niko_order_notes will be updated in-place
  ~ resource "snowflake_stage" "my_stage" {
      ~ file_format          = "FORMAT_NAME = \\\"MY_DATABASE\\\".\\\"MY_SCHEMA\\\".\\\"MY_FILE_FORMAT\\\"" -> "FORMAT_NAME = \"MY_DATABASE\".\"MY_SCHEMA\".\"MY_FILE_FORMAT\""
        id                   = "MY_DATABASE|MY_SCHEMA|MY_STAGE"
        name                 = "MY_STAGE"
        # (10 unchanged attributes hidden)
    }

Any possible resolution for this?

@sfc-gh-asawicki
Copy link
Collaborator

Hey @JohnMav. We will address this issue with the stage redesign. For now, you can suppress this by using the ignore_changes lifecycle attribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Used to mark issues with provider's incorrect behavior category:resource resource:stage Issue connected to the snowflake_stage resource
Projects
None yet
Development

No branches or pull requests

4 participants