fivetran / terraform-provider-fivetran

Terraform Provider for Fivetran
https://fivetran.com
Apache License 2.0
40 stars 23 forks source link

Unmarshal error when creating a Snowflake destination #346

Closed mars-lan closed 1 week ago

mars-lan commented 1 month ago

Describe the bug

When creating a Snowflake destination using key pair auth, the following error is thrown, and the destination is shown as "Broken" on Fivetran:

│ Error: Unable to Create Destination Resource.
│ 
│   with module.fivetran.fivetran_destination.snowflake,
│   on modules/fivetran/main.tf line 168, in resource "fivetran_destination" "snowflake":
│  168: resource "fivetran_destination" "snowflake" {
│ 
│ json: cannot unmarshal bool into Go struct field DestinationConfigResponse.data.config.is_private_key_encrypted of type string;
│ code: Success; message: Setup tests have been completed

To Reproduce Provide an example .tf configuration

Here's a snippet of the config:

resource "fivetran_destination" "snowflake" {
  group_id         = fivetran_group.snowflake.id
  service          = "snowflake"
  time_zone_offset = "0"
  region           = "GCP_US_EAST4"
  run_setup_tests  = true

  config {
    host = var.snowflake.host
    port = 443
    database = var.snowflake.database
    auth = "KEY_PAIR"
    user = var.snowflake.user
    private_key = var.snowflake.key
  }
}

Expected behavior

To not crash.

Plugin version:

1.2.6

jpetitcolas commented 1 month ago

I'm facing the same issue. I tried to add in the config object is_private_key_encrypted = false in vain.

mars-lan commented 1 month ago

I'm facing the same issue. I tried to add in the config object is_private_key_encrypted = false in vain.

Same here. Also tried is_private_key_encrypted = "false" w/o any success. It looks like the issue lies in parsing the API response, not in sending the request.

mars-lan commented 2 weeks ago

Ping @fivetran-aleksandrboldyrev & @fivetran-jovanmanojlovic

fivetran-aleksandrboldyrev commented 2 weeks ago

@mars-lan took as an internal task for verification and solution. Thank you for bringing it to our attention

fivetran-aleksandrboldyrev commented 2 weeks ago

@mars-lan @jpetitcolas please tell me what versions of Terrafrom CLI are you using? I can't reproduce the problem on version 1.9.5, I want to try on your versions

mars-lan commented 2 weeks ago

@mars-lan @jpetitcolas please tell me what versions of Terrafrom CLI are you using? I can't reproduce the problem on version 1.9.5, I want to try on your versions

Terraform v1.6.6 + fivetran/fivetran v1.2.8. I also tried v1.9.5, and it returned the same error. I'm on macOS 14.6.1 if that helps.

fivetran-aleksandrboldyrev commented 2 weeks ago

@mars-lan go it, thank you. I will try again to reproduce and understand the reason for this error.

fivetran-aleksandrboldyrev commented 1 week ago

@mars-lan Hello, Could you check now? There is no need to update the provider, since the fix was on the API side

mars-lan commented 1 week ago

@fivetran-aleksandrboldyrev Confirmed that it's working now. Thanks for the help. Closing the issue.