diff --git a/docs/resources/connection.md b/docs/resources/connection.md index 83e738768..457c523e1 100644 --- a/docs/resources/connection.md +++ b/docs/resources/connection.md @@ -47,6 +47,40 @@ resource "airbyte_connection" "my_connection" { } ``` +Example using [Stream Module](#nestedatt--stream-module) + +```terraform + +module "source_postgres_streams" { + source = "airbytehq/stream-discovery/airbyte" + airbyte_api_token = var.airbyte_api_token + source_id = airbyte_source_postgres.my_source_postgres.source_id + destination_id = airbyte_destination_bigquery.my_destination_bigquery.destination_id +} + +locals { + full_refresh_streams = [for stream in module.source_postgres_streams.streams : + { + name = stream.streamName + sync_mode = "full_refresh_overwrite" + } + ] +} + + +resource "airbyte_connection" "postgres_to_bigquery_full_refresh" { + name = "Postgres to BigQuery Full Refresh" + source_id = airbyte_source_postgres.my_source_postgres.source_id + destination_id = airbyte_destination_bigquery.my_destination_bigquery.destination_id + schedule = { + schedule_type = "manual" + } + configurations = { + streams = local.full_refresh_streams + } +} +``` + ## Schema @@ -94,6 +128,9 @@ Optional: - `primary_key` (List of List of String) Paths to the fields that will be used as primary key. This field is REQUIRED if `destination_sync_mode` is `*_dedup` unless it is already supplied by the source schema. - `sync_mode` (String) must be one of ["full_refresh_overwrite", "full_refresh_append", "incremental_append", "incremental_deduped_history"] + +## Stream Module +If you want to discover the available streams programmatically with terraform, we have released a [Stream Discovery Module](https://registry.terraform.io/modules/airbytehq/stream-discovery/airbyte/latest) which fetches the available streams and sync modes between a source and destination.