Error when specifying primary key in Terraform for Postgres connection with sync type incremental_dedup_history

Summary

When trying to specify a primary key in a stream for a Postgres connection with a sync type of incremental_dedup_history in Terraform, users encounter errors where they are told not to include a primary key configuration, but then prompted to specify one. Resolving this by using “primary_key”: still results in a Terraform error related to unexpected new values.


Question

When I use terraform and try to specify a primary key in a stream for a postgres connection with a sync type of incremental_dedup_history i get

│ key for stream: plans is already pre-defined. Please do NOT include a
│ primary key configuration for this stream```
however, if i do not specify a primary key it tells me I must specify a primary key.  I can get past this by specifying:
```"primary_key": []```
however, this still gives a terraform error:
```When applying changes to
│ airbyte_connection.massdriver_workfront_teams_to_redshift, provider
│ "provider[\"<http://registry.terraform.io/airbytehq/airbyte\|registry.terraform.io/airbytehq/airbyte\>"]" produced an
│ unexpected new value: .configurations.streams[0].primary_key: new element 0
│ has appeared.
│ 
│ This is a bug in the provider, which should be reported in the provider's
│ own issue tracker.```


<br>

---

This topic has been created from a Slack thread to give it more visibility.
It will be on Read-Only mode here. [Click here](https://airbytehq.slack.com/archives/C021JANJ6TY/p1712255377591889) if you want to access the original thread.

[Join the conversation on Slack](https://slack.airbyte.com)

<sub>
["terraform", "primary-key", "postgres-connection", "sync-type", "incremental-dedup-history", "error", "provider-bug"]
</sub>

https://github.com/airbytehq/airbyte/issues/36756

hit very similar issues this week with postgres -> redshift connections

thanks! i’ll post on your issue

sounds like it’s all the same root cause - the provider stores more in state than it should be

i also posted an issue directly on the terraform provider github https://github.com/airbytehq/terraform-provider-airbyte/issues/91

ah ha, good to know there’s a separate repo