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

file_format error when i exec terraform apply a second time without any change #897

Closed
waterdo opened this issue Mar 9, 2022 · 10 comments
Closed
Labels
bug Used to mark issues with provider's incorrect behavior

Comments

@waterdo
Copy link

waterdo commented Mar 9, 2022

Provider Version

  • provider registry.terraform.io/chanzuckerberg/snowflake v0.25.28

Terraform Version

Terraform v1.1.7

Describe the bug

when I exec "terraform apply" a second time without any change of my code, return an error.

Plan: 0 to add, 1 to change, 0 to destroy.
snowflake_file_format.external_storage: Modifying... [id=TF_DAF2|LOG|TFMYCSVFORMAT2]

│ Error: error updating file format compression on TF_DAF2|LOG|TFMYCSVFORMAT2: 001008 (22023): SQL compilation error:
│ invalid value [''] for parameter 'COMPRESSION'

│ with snowflake_file_format.external_storage,
│ on storagefileformat.tf line 3, in resource "snowflake_file_format" "external_storage":
│ 3: resource "snowflake_file_format" "external_storage" {


image

Expected behavior

Not return this error

Code samples and commands

resource "snowflake_file_format" "external_storage" {
name = "TFMYCSVFORMAT2"
database = "TF_DAF2"
schema = "LOG"
format_type = "csv"
depends_on = [
snowflake_schema.schemaparatablas
]
}

Additional context

Add any other context about the problem here.

@waterdo waterdo added the bug Used to mark issues with provider's incorrect behavior label Mar 9, 2022
@baugarcia
Copy link

I am having the same issue. Has anyone found a workaround or a fix for this issue?

@Kannedhara
Copy link

Any work around this issue, we are having the same issue.

@baugarcia
Copy link

@Kannedhara I fixed this for our environment by adding "compression = 'NONE'" in the file format terraform resource creation.

I am guessing the documentation is not really up to date and some parameters are mandatory for different format_types, so even if my parameter does not fix it for you, check the error and try to add a value for whatever parameter it complains.

@crowemi
Copy link

crowemi commented Oct 7, 2022

Here is a listing of the "required" fields (with what I believe are the default values) to get the file_format resource to work as expected:

  validate_utf8 = true
  compression = "AUTO"
  record_delimiter = "\n"
  binary_format = "HEX"
  escape = "NONE"
  time_format = "AUTO"
  timestamp_format = "AUTO"
  date_format = "AUTO"
  encoding = "UTF8"
  escape_unenclosed_field = "\\"
  field_optionally_enclosed_by = "NONE"

@icornett
Copy link

icornett commented Nov 2, 2022

This still seems to be occurring on 0.49.0 as of today. I'm having the same problem even passing default values as shown above.

@jakobfloe
Copy link

Same issue here.

@funes79
Copy link
Contributor

funes79 commented Dec 19, 2022

As @crowemi pointed out, the escape_unenclosed_field needs to be explicitly defined in the resource definition, otherwise it will fail (or will trigger a change every time).

...
  escape_unenclosed_field        = "\\"
...

This is the default setting, what works for me. Provider version 0.52

@kstradinfs
Copy link

Issue still occurring at the moment - Correction by @crowemi worked like a charm

@aliceinnorway
Copy link

aliceinnorway commented Feb 23, 2023

Same issue here for creating a JSON file format. I solved by explicitly adding the default values. Note that @crowemi suggestion is for CSV.

@sfc-gh-asawicki
Copy link
Collaborator

We are closing this issue as part of a cleanup described in announcement. If you believe that the issue is still valid in v0.89.0, please open a new ticket.

@sfc-gh-asawicki sfc-gh-asawicki closed this as not planned Won't fix, can't repro, duplicate, stale Apr 30, 2024
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
Projects
None yet
Development

No branches or pull requests

10 participants