fivetran / terraform-provider-fivetran

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

When applying changes to fivetran_connector_schema_config.dynamodb_schema, provider "provider[\"registry.terraform.io/fivetran/fivetran\"]" produced an unexpected new value: .schemas["dynamodb_raw"].tables: element │ "a5-d-ds-x" has vanished. #314

Closed ann8ty closed 16 hours ago

ann8ty commented 1 month ago

Describe the bug Two of my DDB tables fail with "element has vanished". Can confirm the tables exist (they are empty but so are others).

fivetran_connector_schema_config.dynamodb_schema: Modifying... [id=xxx]
╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to fivetran_connector_schema_config.dynamodb_schema, provider "provider[\"registry.terraform.io/fivetran/fivetran\"]" produced an unexpected new value: .schemas["dynamodb_raw"].tables: element
│ "a5-d-ds-x" has vanished.
│ 
│ 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_connector_schema_config.dynamodb_schema, provider "provider[\"registry.terraform.io/fivetran/fivetran\"]" produced an unexpected new value: .schemas["dynamodb_raw"].tables: element
│ "a5-w-d-s-ltnzt-x" has vanished.
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

To Reproduce

data "aws_ssm_parameter" "ssm_dynamodb_connector_id" {
  name = "/${local.app_env}/${local.schema_name}/dynamodbConnectorId"
}

resource "fivetran_connector_schema_config" "dynamodb_schema" {
  connector_id = data.aws_ssm_parameter.ssm_dynamodb_connector_id.value
  schema_change_handling = "ALLOW_COLUMNS"

  schemas = {
    "dynamodb_raw" = {
      enabled = true

      tables = {

        "a5-a-a-x" = {enabled = true}
        "a5-c-r-x" = { enabled = true }
        "a5-d-a-x"  = { enabled = true }
        "a5-d-cs-x" = { enabled = true }
        "a5-d-ds-x"= { enabled = true } # vanished error
        "a5-d-hs-x"                  = { enabled = true }
        "a5-d-nw-x"                  = { enabled = true }
        "a5-g-d-dl-x"                  = { enabled = true }
        "a5-i-od-x"      = { enabled = true }
        "a5-i-ods-x" = { enabled = true }
        "a5-l-a-x"                         = { enabled = true }
        "a5-l-l-x"                      = { enabled = true }
        # "a5-n-ns-x"    = { enabled = true } # │       attempt to patch locked table a5-n-ns-x; Please report this issue to the provider developers.
        "a5-n-nv3-x"          = { enabled = true }
        # "a5-n-rt-x"       = { enabled = true } # │       attempt to patch locked table a5-n-rt-x; Please report this issue to the provider developers.
        "a5-w-d-s-ltnzt-x"= { enabled = true } # vanished error
        "a5-w-d-s-lttst-x" = { enabled = true }
        "a5-w-d-s-tst-x"           = { enabled = true }
        "a5-w-d-s-ts-x"                = { enabled = true }
        "a5-w-d-s-wa-x"                 = { enabled = true }

      }

      timeouts = {
        create = "60s"
        read = "60s"
        update = "60s"
      }

    }
  }
}

Expected behavior

Expect two tables to add (these worked in a previous version of TF provider), no vanished error.

Logs & Output

$ AWS_PROFILE="dbf" terraform plan -var-file="./$ENVIROMENT_LONG_NAME/$CDK_PREFIX.tfvars" -out=.terraform/$CDK_PREFIX.out

....

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # fivetran_connector_schema_config.dynamodb_schema will be updated in-place
  ~ resource "fivetran_connector_schema_config" "dynamodb_schema" {
      ~ id                     = "xxx" -> (known after apply)
      ~ schemas                = {
          ~ "dynamodb_raw" = {
              ~ tables  = {
                  ~ "a5-a-a-x" = {
                      + sync_mode = (known after apply)
                        # (1 unchanged attribute hidden)
                    },
                  ~ "a5-c-r-x" = {
                      + sync_mode = (known after apply)
                        # (1 unchanged attribute hidden)
                    },
                  ~ "a5-d-a-x" = {
                      + sync_mode = (known after apply)
                        # (1 unchanged attribute hidden)
                    },
                  ~ "a5-d-cs-x" = {
                      + sync_mode = (known after apply)
                        # (1 unchanged attribute hidden)
                    },
                  + "a5-d-ds-x" = {
                      + enabled   = true
                      + sync_mode = (known after apply)
                    },
                  ~ "a5-d-hs-x" = {
                      + sync_mode = (known after apply)
                        # (1 unchanged attribute hidden)
                    },
                  ~ "a5-d-ns-x" = {
                      + sync_mode = (known after apply)
                        # (1 unchanged attribute hidden)
                    },
                  ~ "a5-g-d-dl-x" = {
                      + sync_mode = (known after apply)
                        # (1 unchanged attribute hidden)
                    },
                  ~ "a5-i-od-x" = {
                      + sync_mode = (known after apply)
                        # (1 unchanged attribute hidden)
                    },
                  ~ "a5-i-ods-x" = {
                      + sync_mode = (known after apply)
                        # (1 unchanged attribute hidden)
                    },
                  ~ "a5-l-a-x" = {
                      + sync_mode = (known after apply)
                        # (1 unchanged attribute hidden)
                    },
                  ~ "a5-l-l-x" = {
                      + sync_mode = (known after apply)
                        # (1 unchanged attribute hidden)
                    },
                  ~ "a5-n-nv3-x" = {
                      + sync_mode = (known after apply)
                        # (1 unchanged attribute hidden)
                    },
                  + "a5-wds-ltnzt-x" = {
                      + enabled   = true
                      + sync_mode = (known after apply)
                    },
                  ~ "a5-wds-lttst-x" = {
                      + sync_mode = (known after apply)
                        # (1 unchanged attribute hidden)
                    },
                  ~ "a5-wds-tst-x" = {
                      + sync_mode = (known after apply)
                        # (1 unchanged attribute hidden)
                    },
                  ~ "a5-wds-ts-x" = {
                      + sync_mode = (known after apply)
                        # (1 unchanged attribute hidden)
                    },
                  ~ "a5-wds-wa-x" = {
                      + sync_mode = (known after apply)
                        # (1 unchanged attribute hidden)
                    },
                }
                # (1 unchanged attribute hidden)
            },
        }
        # (2 unchanged attributes hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Changes to Outputs:
  ~ object_test = {
      + a5-d-ds-x                                   = {
          + enabled = true
        }
      - a5-n-ns-x                  = {
          - enabled = true
        }
      - a5-n-rt-x                     = {
          - enabled = true
        }
      + a5-wds-ltnzt-x       = {
          + enabled = true
        }
        # (16 unchanged attributes hidden)
    }

──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Saved the plan to: .terraform/a5.out

To perform exactly these actions, run the following command to apply:
    terraform apply ".terraform/a5.out"
(.venv) ~ $ AWS_PROFILE="dbf" terraform apply .terraform/$CDK_PREFIX.out                                                           

fivetran_connector_schema_config.dynamodb_schema: Modifying... [id=xxx]
╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to fivetran_connector_schema_config.dynamodb_schema, provider "provider[\"registry.terraform.io/fivetran/fivetran\"]" produced an unexpected new value: .schemas["dynamodb_raw"].tables: element
│ "a5-d-ds-x" has vanished.
│ 
│ 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_connector_schema_config.dynamodb_schema, provider "provider[\"registry.terraform.io/fivetran/fivetran\"]" produced an unexpected new value: .schemas["dynamodb_raw"].tables: element
│ "a5-wds-ltnzt-x" has vanished.
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵

Plugin version: v1.1.24

Additional context

I've now also seen "has appeared" and I am wondering if this a comment about the state file, so I've tried to rm the whole schema from the state file to start fresh.

beevital commented 1 week ago

@ann8ty should be fixed in v1.2.0

beevital commented 16 hours ago

Closing the issue as the fix was released. Feel free to re-open or open a new one id the fix didn't work for you.