Terraform Import Configuration Fields Issue

Summary

After successfully importing a Postgres source and BigQuery destination using Terraform, the configuration fields are identified as ‘add’ in terraform plan even though the values are the same. Additionally, the configuration fields in the .tfstate file are set to null, which is unexpected.


Question

Hi guys,
I tried to import an existing Postgres source using terraform import and I was successful :white_check_mark:
I did the same for BigQuery destination as well and again I was successful :white_check_mark:

But I noticed terraform plan identifying all “configuration” related fields to be in “add” mode. But the field values are all the same. I also noticed that after importing, in the .tfstate file, that the configuration fields are all set to null, which is not expected right?

Id love to get some help here! Thanks a lot!



This topic has been created from a Slack thread to give it more visibility.
It will be on Read-Only mode here. Click here if you want
to access the original thread.

Join the conversation on Slack

["terraform", "import", "configuration-fields", "tfstate", "postgres-source", "bigquery-destination"]

How my tfstate looks, look how configuration fields all say null?

      "module": "module.pg__api_staging__1",
      "mode": "managed",
      "type": "airbyte_source_postgres",
      "name": "this",
      "provider": "provider[\"<http://registry.terraform.io/airbytehq/airbyte\|registry.terraform.io/airbytehq/airbyte\>"]",
      "instances": [
        {
          "schema_version": 0,
          "attributes": {
            "configuration": {
              "database": null,
              "host": null,
              "jdbc_url_params": null,
              "password": null,
              "port": null,
              "replication_method": null,
              "schemas": null,
              "ssl_mode": null,
              "tunnel_method": null,
              "username": null
            },
            "definition_id": null,
            "name": "pg__api_staging__1",
            "secret_id": null,
            "source_id": &lt;redacted&gt;,
            "source_type": "postgres",
            "workspace_id": &lt;redacted&gt;
          },
          "sensitive_attributes": [],
          "dependencies": [&lt;redacted&gt;]
        }
      ]
    },```

this is what terraform plan identifies as issue

There are some quirks with terraform-provider-airbyte and I wouldn’t worry much about this.
If you are sure that terraform code is correct, just apply changes.

It is possible that something is not read from API or asterisks returned by API (password = (sensitive value)) mess with configuration attribute.

https://github.com/airbytehq/terraform-provider-airbyte/issues/81#issuecomment-1964294730|terraform-provider-airbyte/issues/81
https://github.com/airbytehq/terraform-provider-airbyte/blob/1934e7cb1dbcacf168607e797f1e323d3d6752e5/internal/sdk/models/shared/sourceresponse.go#L8|sourceresponse.go#L8

Thanks for the reply! As suggested I’ll overlook this for now :slightly_smiling_face: