fivetran / terraform-provider-fivetran

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

Breaking change from 1.1.17 -> 1.1.18 without removal notification #290

Closed pancochea closed 5 months ago

pancochea commented 5 months ago

This update breaks all implementations of fivetran_connector_schema_config, patch versions are suposed to be retrocompatible. Although this change is reported in the changelog, we expected a deprecation warning, not a direct removal in a patch update.

resource "fivetran_connector_schema_config" "schema" {
  connector_id = "connector_id"
  schema_change_handling = "ALLOW_ALL"
  schemas = {
    "schema_name" = {
      tables = {
        "table_name" = {
          columns = {
            "hashed_column_name" = {
              hashed = true
            }
            "blocked_column_name" = {
              enabled = false
            }
          }
        }
        "blocked_table_name" = {
          enabled = false
        }
      }
    }
    "blocked_schema" = {
      enabled = false
    }
  }
}`

Error:

panic: AttributeName("daylight_saving_time_enabled"): can't use tftypes.String as tftypes.Bool

goroutine 62 [running]:
github.com/hashicorp/terraform-plugin-go/tftypes.NewValue(...)
        github.com/hashicorp/terraform-plugin-go@v0.19.0/tftypes/value.go:278
github.com/fivetran/terraform-provider-fivetran/fivetran/framework/resources.upgradeDestinationState({0x0?, 0x0?}, {0xc000834200?, 0x0?}, 0xc0000add10, 0x0?)
        github.com/fivetran/terraform-provider-fivetran/fivetran/framework/resources/destination_migrations.go:36 +0xe4c
github.com/fivetran/terraform-provider-fivetran/fivetran/framework/resources.(*destination).UpgradeState.func1({0x1020900?, 0xc0007c2db0?}, {0xc000834200?, 0x0?}, 0xeb14ba?)
        github.com/fivetran/terraform-provider-fivetran/fivetran/framework/resources/destination.go:49 +0x30
github.com/hashicorp/terraform-plugin-framework/internal/fwserver.(*Server).UpgradeResourceState(0xc0000ea000, {0x1020900, 0xc0007c2db0}, 0xc0007c3500, 0xc0004e5580)
        github.com/hashicorp/terraform-plugin-framework@v1.4.2/internal/fwserver/server_upgraderesourcestate.go:198 +0x9bf
github.com/hashicorp/terraform-plugin-framework/internal/proto6server.(*Server).UpgradeResourceState(0xc0000ea000, {0x1020900?, 0xc0007c2c60?}, 0xc0008341e0)
        github.com/hashicorp/terraform-plugin-framework@v1.4.2/internal/proto6server/server_upgraderesourcestate.go:51 +0x23f
github.com/hashicorp/terraform-plugin-mux/tf6muxserver.(*muxServer).UpgradeResourceState(0x1020858?, {0x1020900?, 0xc0007c2930?}, 0xc0008341e0)
        github.com/hashicorp/terraform-plugin-mux@v0.12.0/tf6muxserver/mux_server_UpgradeResourceState.go:36 +0x1b5
github.com/hashicorp/terraform-plugin-go/tfprotov6/tf6server.(*server).UpgradeResourceState(0xc0005bba40, {0x1020900?, 0xc0007c21b0?}, 0xc0000adb80)
        github.com/hashicorp/terraform-plugin-go@v0.19.0/tfprotov6/tf6server/server.go:755 +0x270
github.com/hashicorp/terraform-plugin-go/tfprotov6/internal/tfplugin6._Provider_UpgradeResourceState_Handler({0xe5f500?, 0xc0005bba40}, {0x1020900, 0xc0007c21b0}, 0xc0001b6000, 0x0)
        github.com/hashicorp/terraform-plugin-go@v0.19.0/tfprotov6/internal/tfplugin6/tfplugin6_grpc.pb.go:395 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000676000, {0x1026100, 0xc000103380}, 0xc0007ca000, 0xc0004a0e10, 0x163e6d8, 0x0)
        google.golang.org/grpc@v1.57.0/server.go:1360 +0xe23
google.golang.org/grpc.(*Server).handleStream(0xc000676000, {0x1026100, 0xc000103380}, 0xc0007ca000, 0x0)
        google.golang.org/grpc@v1.57.0/server.go:1737 +0xa2f
google.golang.org/grpc.(*Server).serveStreams.func1.1()
        google.golang.org/grpc@v1.57.0/server.go:982 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
        google.golang.org/grpc@v1.57.0/server.go:980 +0x18c

Error: The terraform-provider-fivetran_v1.1.20 plugin crashed!

This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.

Failed generating plan JSON
Exit code: 1

Failed to marshal plan to json: error marshaling prior state: schema version 2 for fivetran_connector.dms in state does not match version 3 from the provider
Operation failed: 2 errors occurred:
        * failed running terraform plan (exit 1)
        * failed generating plan JSON: failed running command (exit 1)`
beevital commented 5 months ago

@pancochea it was schema field, and it is deprecated, not removed: https://registry.terraform.io/providers/fivetran/fivetran/latest/docs/resources/connector_schema_config#nested-schema-for-schema There's no BC here.

Error is caused by another field: panic: AttributeName("daylight_saving_time_enabled"): can't use tftypes.String as tftypes.Bool Of another resource.

patch versions are suposed to be retrocompatible

The problem is caused by field fivetran_destination. daylight_saving_time_enabled

beevital commented 5 months ago

Nothing was removed from schema. Documentation just updated to use non-deprecated field.

beevital commented 5 months ago

As for daylight_saving_time_enabled field: will figure out what's wrong and prepare a fix soon.

beevital commented 5 months ago

UPD: reproduced the issue. It doesn't related with fivetran_connector_schema_config resource as expected. The problem is with migration code from legacy destination schema (provider version < 0.7.1).