Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
.terraform*
*.tfstate*
.DS_Store
*.tfvars
*.tfvars
*.iml
airbyte_overlayed.yaml
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
.PHONY: all docs
.PHONY: all docs speakeasy
all: speakeasy docs

speakeasy:
speakeasy generate sdk --lang terraform -o . -s airbyte.yaml
speakeasy: airbyte_overlayed.yaml
speakeasy generate sdk --lang terraform -o . -s airbyte_overlayed.yaml

airbyte_overlayed.yaml: overlay.yaml airbyte.yaml
speakeasy overlay apply -o ./overlay.yaml -s airbyte.yaml > airbyte_overlayed.yaml

docs:
go generate ./...
Expand Down
33 changes: 30 additions & 3 deletions docs/resources/connection.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "airbyte_connection Resource - terraform-provider-airbyte"
subcategory: ""
description: |-
Expand Down Expand Up @@ -47,6 +46,36 @@ 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 generated by tfplugindocs -->
## Schema

Expand Down Expand Up @@ -111,5 +140,3 @@ Optional:
Read-Only:

- `basic_timing` (String)


2 changes: 1 addition & 1 deletion docs/resources/destination_s3.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ resource "airbyte_destination_s3" "my_destination_s3" {
s3_bucket_path = "data_sync/test"
s3_bucket_region = "ap-southeast-1"
s3_endpoint = "http://localhost:9000"
s3_path_format = "${NAMESPACE}/${STREAM_NAME}/${YEAR}_${MONTH}_${DAY}_${EPOCH}_"
s3_path_format = "$${NAMESPACE}/$${STREAM_NAME}/$${YEAR}_$${MONTH}_$${DAY}_$${EPOCH}_"
secret_access_key = "a012345678910ABCDEFGH/AbCdEfGhEXAMPLEKEY"
}
definition_id = "b1d5b002-89a0-4dc0-a329-a5cae9f38884"
Expand Down
2 changes: 1 addition & 1 deletion examples/resources/airbyte_destination_s3/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ resource "airbyte_destination_s3" "my_destination_s3" {
s3_bucket_path = "data_sync/test"
s3_bucket_region = "ap-southeast-1"
s3_endpoint = "http://localhost:9000"
s3_path_format = "${NAMESPACE}/${STREAM_NAME}/${YEAR}_${MONTH}_${DAY}_${EPOCH}_"
s3_path_format = "$${NAMESPACE}/$${STREAM_NAME}/$${YEAR}_$${MONTH}_$${DAY}_$${EPOCH}_"
secret_access_key = "a012345678910ABCDEFGH/AbCdEfGhEXAMPLEKEY"
}
definition_id = "b1d5b002-89a0-4dc0-a329-a5cae9f38884"
Expand Down
8 changes: 8 additions & 0 deletions overlay.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
overlay: 1.0.0
info:
title: AirByte Overlay
version: 0.1
actions:
- target: $.components.schemas["destination-s3"].properties.s3_path_format.examples[0]
update:
"$${NAMESPACE}/$${STREAM_NAME}/$${YEAR}_$${MONTH}_$${DAY}_$${EPOCH}_"
48 changes: 48 additions & 0 deletions templates/resources/connection.md.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}"
subcategory: ""
description: |-
{{ .Description | plainmarkdown | trimspace | prefixlines " " }}
---

# {{.Name}} ({{.Type}})

{{ .Description | trimspace }}

{{ if .HasExample -}}
## Example Usage

{{ tffile "examples/resources/airbyte_connection/resource.tf" }}
{{- end }}

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
}
}
```

{{ .SchemaMarkdown | trimspace }}