Skip to content

Commit

Permalink
Merge pull request #4 from aballiet/feat-add-operation-resource
Browse files Browse the repository at this point in the history
Feat add operation resource
  • Loading branch information
aballiet authored Nov 17, 2023
2 parents d2f3a3d + 8e926dc commit faaf079
Show file tree
Hide file tree
Showing 32 changed files with 1,320 additions and 73 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@ To install this provider, copy and paste this code into your Terraform configura
terraform {
required_providers {
airbyte = {
source = "aballiet/airbyte"
version = "1.0.6"
source = "aballiet/airbyte-oss"
version = "1.0.7"
}
}
}
provider "airbyte" {
# Configuration options
# Must match your Airbyte server endpoint (airbyte-server-svc on k8s)
server_url = "http://localhost:8001/api/"
username = "YOUR_USERNAME"
password = "YOUR_PASSWORD"
}
```
<!-- End SDK Installation -->
Expand Down
82 changes: 82 additions & 0 deletions docs/data-sources/airbyte_operation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "airbyte_operation Data Source - aballiet-terraform-provider-airbyte-oss"
subcategory: ""
description: |-
Operation DataSource
---

# airbyte_operation (Data Source)

Operation DataSource

## Example Usage

```terraform
data "airbyte_operation" "my_operation" {
operation_id = "cd96c08a-642e-4276-9d0a-b8d096c23af1"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `operation_id` (String)

### Read-Only

- `name` (String)
- `operator_configuration` (Attributes) (see [below for nested schema](#nestedatt--operator_configuration))
- `workspace_id` (String)

<a id="nestedatt--operator_configuration"></a>
### Nested Schema for `operator_configuration`

Read-Only:

- `dbt` (Attributes) (see [below for nested schema](#nestedatt--operator_configuration--dbt))
- `normalization` (Attributes) (see [below for nested schema](#nestedatt--operator_configuration--normalization))
- `operator_type` (String) must be one of ["normalization", "dbt", "webhook"]
- `webhook` (Attributes) (see [below for nested schema](#nestedatt--operator_configuration--webhook))

<a id="nestedatt--operator_configuration--dbt"></a>
### Nested Schema for `operator_configuration.dbt`

Read-Only:

- `dbt_arguments` (String)
- `docker_image` (String)
- `git_repo_branch` (String)
- `git_repo_url` (String)


<a id="nestedatt--operator_configuration--normalization"></a>
### Nested Schema for `operator_configuration.normalization`

Read-Only:

- `option` (String) must be one of ["basic"]


<a id="nestedatt--operator_configuration--webhook"></a>
### Nested Schema for `operator_configuration.webhook`

Read-Only:

- `dbt_cloud` (Attributes) (see [below for nested schema](#nestedatt--operator_configuration--webhook--dbt_cloud))
- `execution_body` (String) DEPRECATED. Populate dbtCloud instead.
- `execution_url` (String) DEPRECATED. Populate dbtCloud instead.
- `webhook_config_id` (String) The id of the webhook configs to use from the workspace.
- `webhook_type` (String) must be one of ["dbtCloud"]

<a id="nestedatt--operator_configuration--webhook--dbt_cloud"></a>
### Nested Schema for `operator_configuration.webhook.dbt_cloud`

Read-Only:

- `account_id` (Number) The account id associated with the job
- `job_id` (Number) The job id associated with the job


2 changes: 1 addition & 1 deletion docs/data-sources/airbyte_source.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Source DataSource

```terraform
data "airbyte_source" "my_source" {
source_id = "f1402c7e-2666-4964-b1e5-4ee038120ec2"
source_id = "300de2cb-a926-4083-9cde-dc24be26fa48"
}
```

Expand Down
4 changes: 2 additions & 2 deletions docs/data-sources/airbyte_source_schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ SourceSchema DataSource

```terraform
data "airbyte_source_schema" "my_sourceschema" {
connection_id = "2ac978db-e310-4dc6-a194-f112ed73d68a"
connection_id = "a24e9eae-dfd4-401e-81ae-1e8142cfc767"
disable_cache = true
notify_schema_change = false
source_id = "280eecd9-6c08-4a64-ae27-6dd0ab8d096c"
source_id = "2da61c2e-c391-4007-81f2-dadfe355f97c"
}
```

Expand Down
48 changes: 36 additions & 12 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,32 +40,56 @@ WARNING
* This API is utilized internally by the Airbyte Engineering team and may be modified in the future if the need arises.
* Modifications by the Airbyte Engineering team could create breaking changes and OSS users would need to update their code to catch up to any backwards incompatible changes in the API.

This API is a collection of HTTP RPC-style methods. While it is not a REST API, those familiar with REST should find the conventions of this API recognizable.

Here are some conventions that this API follows:
* All endpoints are http POST methods.
* All endpoints accept data via `application/json` request bodies. The API does not accept any data via query params.
* The naming convention for endpoints is: localhost:8000/{VERSION}/{METHOD_FAMILY}/{METHOD_NAME} e.g. `localhost:8000/v1/connections/create`.
* For all `update` methods, the whole object must be passed in, even the fields that did not change.

Authentication (OSS):
* When authenticating to the Configuration API, you must use Basic Authentication by setting the Authentication Header to Basic and base64 encoding the username and password (which are `airbyte` and `password` by default - so base64 encoding `airbyte:password` results in `YWlyYnl0ZTpwYXNzd29yZA==`). So the full header reads `'Authorization': "Basic YWlyYnl0ZTpwYXNzd29yZA=="`
* When authenticating to the Configuration API, you must use Basic Authentication by setting username and password (which are `airbyte` and `password` by default).

## Example Usage

```terraform
terraform {
required_providers {
airbyte = {
source = "aballiet/airbyte"
version = "1.0.6"
source = "aballiet/airbyte-oss"
version = "1.0.7"
}
}
}
provider "airbyte" {
# Configuration options
server_url = "http://localhost:8001/api/" # Must match your Airbyte server endpoint (airbyte-server-svc on k8s)
username = "YOUR_USERNAME"
password = "YOUR_PASSWORD"
}
```

Below a full example with a custom connector : defining a `SourceDefintion`, `Source` and a `Connection` :

```hcl
locals {
workspace_id = "<MY_AIRBYTE_WORKSPACE_ID>"
}
resource "airbyte_source_definition" "ashby" {
source_definition = {
docker_image_tag = "0.1.0"
docker_repository = "us-central1-docker.pkg.dev/<MY_GCP_PROJECT>/airbyte/source-ashby"
documentation_url = "https://developers.ashbyhq.com/reference/introduction"
name = "Ashby"
}
workspace_id = local.workspace_id
}
resource "airbyte_source" "ashby" {
connection_configuration = jsonencode({
api_key = "<MY_API_KEY>"
})
name = "Ashby"
source_definition_id = airbyte_source_definition.ashby.source_definition_id
workspace_id = local.workspace_id
}
# TODO for connection : I will publish a Terraform module to make it easier (need to discover Stream schema)
```

<!-- schema generated by tfplugindocs -->
Expand Down
111 changes: 111 additions & 0 deletions docs/resources/airbyte_operation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "airbyte_operation Resource - aballiet-terraform-provider-airbyte-oss"
subcategory: ""
description: |-
Operation Resource
---

# airbyte_operation (Resource)

Operation Resource

## Example Usage

```terraform
resource "airbyte_operation" "my_operation" {
name = "Ervin Renner DVM"
operator_configuration = {
dbt = {
dbt_arguments = "...my_dbt_arguments..."
docker_image = "...my_docker_image..."
git_repo_branch = "...my_git_repo_branch..."
git_repo_url = "...my_git_repo_url..."
}
normalization = {
option = "basic"
}
operator_type = "dbt"
webhook = {
dbt_cloud = {
account_id = 3
job_id = 3
}
execution_body = "...my_execution_body..."
execution_url = "...my_execution_url..."
webhook_config_id = "25dbfb01-6861-4001-b358-7515722b625e"
webhook_type = "dbtCloud"
}
}
workspace_id = "fa1bbfa8-d645-4f71-9d13-3279f15ad8bb"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `name` (String)
- `operator_configuration` (Attributes) (see [below for nested schema](#nestedatt--operator_configuration))
- `workspace_id` (String)

### Read-Only

- `operation_id` (String)

<a id="nestedatt--operator_configuration"></a>
### Nested Schema for `operator_configuration`

Required:

- `operator_type` (String) must be one of ["normalization", "dbt", "webhook"]

Optional:

- `dbt` (Attributes) (see [below for nested schema](#nestedatt--operator_configuration--dbt))
- `normalization` (Attributes) (see [below for nested schema](#nestedatt--operator_configuration--normalization))
- `webhook` (Attributes) (see [below for nested schema](#nestedatt--operator_configuration--webhook))

<a id="nestedatt--operator_configuration--dbt"></a>
### Nested Schema for `operator_configuration.dbt`

Required:

- `git_repo_url` (String)

Optional:

- `dbt_arguments` (String)
- `docker_image` (String)
- `git_repo_branch` (String)


<a id="nestedatt--operator_configuration--normalization"></a>
### Nested Schema for `operator_configuration.normalization`

Optional:

- `option` (String) must be one of ["basic"]


<a id="nestedatt--operator_configuration--webhook"></a>
### Nested Schema for `operator_configuration.webhook`

Optional:

- `dbt_cloud` (Attributes) (see [below for nested schema](#nestedatt--operator_configuration--webhook--dbt_cloud))
- `execution_body` (String) DEPRECATED. Populate dbtCloud instead.
- `execution_url` (String) DEPRECATED. Populate dbtCloud instead.
- `webhook_config_id` (String) The id of the webhook configs to use from the workspace.
- `webhook_type` (String) must be one of ["dbtCloud"]

<a id="nestedatt--operator_configuration--webhook--dbt_cloud"></a>
### Nested Schema for `operator_configuration.webhook.dbt_cloud`

Required:

- `account_id` (Number) The account id associated with the job
- `job_id` (Number) The job id associated with the job


6 changes: 3 additions & 3 deletions docs/resources/airbyte_source.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ Source Resource
```terraform
resource "airbyte_source" "my_source" {
connection_configuration = { "user" : "charles" }
name = "Ervin Renner DVM"
name = "Lana Trantow"
secret_id = "airbyte_oauth_workspace_0509f049-d671-48cb-8105-0a23d47e6db6_secret_e0d38206-034e-4d75-9d21-da5a99b02826_v1"
source_definition_id = "95525dbf-b016-4861-8013-3587515722b6"
workspace_id = "25efa1bb-fa8d-4645-b719-d133279f15ad"
source_definition_id = "fac9256c-f878-4498-930f-77eda0554f68"
workspace_id = "58fc3535-457d-4244-a68f-f977c6f814b5"
}
```

Expand Down
10 changes: 5 additions & 5 deletions docs/resources/airbyte_source_definition.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ SourceDefinition Resource

```terraform
resource "airbyte_source_definition" "my_sourcedefinition" {
scope_id = "8bb3fe33-fac9-4256-8f87-8498930f77ed"
scope_type = "organization"
scope_id = "f1dc406d-3e60-467c-8faa-27e0571d07b1"
scope_type = "workspace"
source_definition = {
name = "Holly Hane"
name = "Rafael Barrows"
docker_repository = "...my_docker_repository..."
docker_image_tag = "...my_docker_image_tag..."
documentation_url = "http://moist-escalator.name"
documentation_url = "https://quick-witted-laboratory.biz"
icon = "...my_icon..."
resource_requirements = {
default = {
Expand All @@ -42,7 +42,7 @@ resource "airbyte_source_definition" "my_sourcedefinition" {
]
}
}
workspace_id = "c3535457-d244-4268-bf97-7c6f814b5f1d"
workspace_id = "355b45bc-e45d-4e0c-a038-bc3c12192fc9"
}
```

Expand Down
6 changes: 3 additions & 3 deletions docs/resources/airbyte_source_definition_manifest.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ resource "airbyte_source_definition_manifest" "my_sourcedefinitionmanifest" {
description = "...my_description..."
manifest = {}
spec = {}
version = 8
version = 1
}
set_as_active_manifest = true
source_definition_id = "06d3e606-7c0f-4aa2-be05-71d07b12f607"
workspace_id = "aea75f35-5b45-4bce-85de-0c2038bc3c12"
source_definition_id = "651b10e8-de28-4ee3-9676-1ccc7d20b17e"
workspace_id = "ae1dd9c4-3502-47c4-ac7c-d806319146c8"
}
```

Expand Down
Loading

0 comments on commit faaf079

Please sign in to comment.