fivetran / terraform-provider-fivetran

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

Databricks destination - provider created inconsistent result after apply #305

Closed ktadiko closed 1 month ago

ktadiko commented 2 months ago

Describe the bug Get the following error after applying

To Reproduce (relevant code)

resource "fivetran_group" "group" {
  name = "${var.env}_databricks"
}

resource "fivetran_destination" "dest" {
  group_id                     = fivetran_group.group.id
  service                      = "databricks"
  time_zone_offset             = "-8"
  region                       = "AWS_US_EAST_1"
  trust_certificates           = "true"
  trust_fingerprints           = "true"
  daylight_saving_time_enabled = "true"
  run_setup_tests              = "true"

  config {
    catalog               = "raw_${var.env}"
    cloud_provider        = "AWS"
    connection_type       = "Directly"
    auth_type             = "PERSONAL_ACCESS_TOKEN"
    http_path             = module.fivetran_warehouse.output.odbc_params[0].path
    personal_access_token = resource.databricks_obo_token.fivetran.token_value
    port                  = module.fivetran_warehouse.output.odbc_params[0].port
    server_host_name      = module.fivetran_warehouse.output.odbc_params[0].hostname
  }

  depends_on = [module.databricks_workspace, module.unity_catalog, module.fivetran_warehouse]
}

data "aws_rds_cluster" "fhirserver" {
  cluster_identifier = "${var.env}-fhirserver-aurora-curai"
}

resource "fivetran_connector" "fhir" {
  service  = "aurora_postgres"
  group_id = fivetran_group.group.id

  destination_schema {
    prefix = "fhir"
  }

  trust_certificates = true

  config {
    host             = data.aws_rds_cluster.fhirserver.reader_endpoint
    port             = 5454
    user             = "fivetran_databricks"
    password         = ...
    update_method    = "TELEPORT"
    always_encrypted = true
    connection_type  = "Directly"
  }
}

Expected behavior terraform apply should work and not cause a drift after it finishes

Logs & Output (terraform apply)

fivetran_destination.dest: Still creating... [30s elapsed]
╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to fivetran_destination.dest, provider
│ "provider[\"registry.terraform.io/fivetran/fivetran\"]" produced an
│ unexpected new value: .config.auth_type: was
│ cty.StringVal("PERSONAL_ACCESS_TOKEN"), but now null.
│ 
│ This is a bug in the provider, which should be reported in the provider's
│ own issue tracker.
╵
╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to fivetran_destination.dest, provider
│ "provider[\"registry.terraform.io/fivetran/fivetran\"]" produced an
│ unexpected new value: .config.cloud_provider: was cty.StringVal("AWS"), but
│ now null.
│ 
│ This is a bug in the provider, which should be reported in the provider's
│ own issue tracker.

Plugin version: 1.1.22

beevital commented 1 month ago

@ktadiko the problem seems to be on API side. We'll fix it, so you won't need to update terraform version etc. I'll inform you about that here when the fix will be deployed.

The problem is that API doesn't return these fields in response, but terraform provider expects it to be returned with expected values.

beevital commented 1 month ago

@ktadiko could you please try to reproduce again? The fix was deployed on Fivetran API.

beevital commented 1 month ago

Fixed on API side. Closing the issue.