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]: NULL_IF in file format shows as null in terraform state when set to empty string in Snowflake #3325

Open
1 task
ijeffries opened this issue Jan 6, 2025 · 1 comment
Labels
bug Used to mark issues with provider's incorrect behavior resource:file_format Issue connected to the snowflake_file_format resource

Comments

@ijeffries
Copy link

ijeffries commented Jan 6, 2025

Terraform CLI Version

5.79.0

Terraform Provider Version

0.99.0

Company Name

National Debt Relief

Terraform Configuration

# snowflake_file_format.create_file_formats["COPY_INTO_FORMAT"] will be updated in-place
  ~ resource "snowflake_file_format" "create_file_formats" {
        id                             = "COPY_INTO_FORMAT"
        name                           = "COPY_INTO_FORMAT"
      ~ null_if                        = [
          ~ null -> "''",
        ]
        # (25 unchanged attributes hidden)
    }

Category

category:resource

Object type(s)

FILE FORMAT

Expected Behavior

I expect the null_if to replace empty strings in my s3 files with NULL. This is how it behaves when I create the file format myself in Snowflake:

alter file format xxx.xxx.COPY_INTO_FORMAT set NULL_IF = ('')

Actual Behavior

I set the nullif to an empty string in terraform (null_if = ["''"]) and it wasn't actually replacing empty strings with NULL when I load from s3. I then ran the above alter command in snowflake and now I get the terraform state mismatch shown in the terraform configuration snippet. Terraform is interpreting alter file format xxx.xxx.COPY_INTO_FORMAT set NULL_IF = ('') as null, and I can't set the terraform configuration to null.

Steps to Reproduce

Create a file format in snowflake with the parameter NULL_IF = ('').

See that you can't get terraform to match, because it interprets this parameter as null from snowflake.

How much impact is this issue causing?

Low

Logs

No response

Additional Information

No response

Would you like to implement a fix?

  • Yeah, I'll take it 😎
@ijeffries ijeffries added the bug Used to mark issues with provider's incorrect behavior label Jan 6, 2025
@sfc-gh-asawicki sfc-gh-asawicki added the resource:file_format Issue connected to the snowflake_file_format resource label Jan 7, 2025
@sfc-gh-asawicki
Copy link
Collaborator

Hey @ijeffries. Thanks for reaching out to us.

The file format resource is still a preview resource in the provider. We will address this problem while reworking it. This issue might be a duplicate of #1609.

For now, treat it as a limitation of the provider.

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 resource:file_format Issue connected to the snowflake_file_format resource
Projects
None yet
Development

No branches or pull requests

2 participants