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

parse_header attribute cannot be set to true in snowflake_file_format resource #2176

Closed
AleksaC opened this issue Nov 7, 2023 · 1 comment · Fixed by #2192
Closed

parse_header attribute cannot be set to true in snowflake_file_format resource #2176

AleksaC opened this issue Nov 7, 2023 · 1 comment · Fixed by #2192
Labels
bug Used to mark issues with provider's incorrect behavior

Comments

@AleksaC
Copy link

AleksaC commented Nov 7, 2023

Provider Version

0.75.0

Terraform Version

1.4.6

Describe the bug

I keep getting the error

Error: ParseHeader and SkipHeader cannot be set simultaneously

even though I haven't set skip_header. I also tried setting it to 0 or even null but it still doesn't work.

Expected behavior

After glancing at the provider implementation I think that is the culprit is ResourceData.Get because it returns 0 even if the field is set to null or not set at all. Example usage:

opts.CSVSkipHeader = sdk.Int(d.Get("skip_header").(int))

Code samples and commands

resource "snowflake_file_format" "csv" {
  name         = local.service_name
  database     = var.sf_db
  schema       = var.sf_schema
  format_type  = "CSV"
  compression  = "AUTO"
}

works

resource "snowflake_file_format" "csv" {
  name         = local.service_name
  database     = var.sf_db
  schema       = var.sf_schema
  format_type  = "CSV"
  compression  = "AUTO"
  parse_header = true
}

throws:

snowflake_file_format.csv: Creating...
╷
│ Error: ParseHeader and SkipHeader cannot be set simultaneously
│ 
│   with snowflake_file_format.csv,
│   on snowpipe.tf line 1, in resource "snowflake_file_format" "csv":
│    1: resource "snowflake_file_format" "csv" {
│ 
╵
@AleksaC AleksaC added the bug Used to mark issues with provider's incorrect behavior label Nov 7, 2023
@sfc-gh-asawicki
Copy link
Collaborator

Hey @AleksaC. Thanks for creating the issue.

You are right; it seems that this is a problem causing the issue you are experiencing. I will confirm that and apply the correction this week.

sfc-gh-asawicki added a commit that referenced this issue Nov 14, 2023
sfc-gh-asawicki added a commit that referenced this issue Nov 14, 2023
* Fix file format csv parameters config

Fixes #2176

* Fix show by id for dynamic table

Fixes #2173

* Add helper method

* Refactor test

* Fix 2134

Fixes #2134

* Fix 1947

Fixes #1947

* Fix fmt

* Fix after review
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

Successfully merging a pull request may close this issue.

2 participants