<@U04S8PLJWMT> - Error: failure to invoke API │ │ ...
# replication-ask-ai
e
@kapa.ai - Error: failure to invoke API │ │ with airbyte_source_definition.mongodb_source, │ on main.tf line 141, in resource "airbyte_source_definition" "mongodb_source": │ 141: resource "airbyte_source_definition" "mongodb_source" { │ │ error sending request: Post
k
The knowledge sources don’t contain the full error message (it’s truncated after
error sending request: Post
), so I can’t see the exact cause. I can only infer a few possibilities from what is documented. 1. The resource itself is valid The
airbyte_source_definition
Terraform resource is the correct way to create a custom Docker-based source definition, and its minimal schema is:
name
,
workspace_id
,
docker_repository
,
docker_image_tag
, and optional
documentation_url
.[source_definition resource] Example from the docs:
Copy code
resource "airbyte_source_definition" "my_sourcedefinition" {
     docker_image_tag  = "...my_docker_image_tag..."
     docker_repository = "...my_docker_repository..."
     documentation_url = "https://fuzzy-alert.name/"
     name              = "...my_name..."
     workspace_id      = "2f247b56-4c74-41ae-8045-9f64dd27512e"
   }
2. Known provider / API issues that might be related ◦ There is a known issue where the Terraform provider fails when the API rejects a field value (e.g.,
data_residency
case mismatch) and surfaces only a generic “failure to invoke API” error.[data_residency issue] ◦ There is also an open issue in OSS 1.8.5 where creating custom source definitions via the new
/api/public/v1/workspaces/{workspaceId}/definitions/sources
endpoint fails due to an internal auth/token problem between worker and control-plane, while the legacy
/api/v1/source_definitions/create_custom
endpoint and the UI still work.[1.8.5 custom source issue] The
airbyte_source_definition
Terraform resource uses this newer
/definitions/sources
API, so on OSS 1.8.5 you may be hitting that exact bug.[1.8.5 custom source issue] 3. Workarounds suggested in the sources Based on that OSS 1.8.5 issue, the only documented workarounds are: ◦ Create the custom source definition via the UI, which internally calls
/api/v1/source_definitions/create_custom
and succeeds.[1.8.5 custom source issue] ◦ Or call that legacy endpoint yourself (bypassing Terraform), e.g.:
Copy code
curl --request POST \
         --url http://<your-airbyte-host>/api/v1/source_definitions/create_custom \
         --header 'accept: application/json' \
         --header 'content-type: application/json' \
         --data '{
           "workspaceId": "<WORKSPACE_ID>",
           "sourceDefinition": {
             "name": "<NAME>",
             "documentationUrl": "",
             "dockerImageTag": "latest",
             "dockerRepository": "<DOCKER_REPOSITORY>"
           }
         }'
[1.8.5 custom source issue] After creating the definition this way, you could then import it into Terraform using the documented import syntax for
airbyte_source_definition
.[source_definition resource] 4. What you can try next Given the docs and issues: ◦ If you’re on Airbyte OSS 1.8.5, your error is very likely the same
/definitions/sources
bug; use the UI or the legacy
/api/v1/source_definitions/create_custom
endpoint, then import into Terraform. ◦ If you’re on a different version, the knowledge sources don’t provide enough detail to diagnose further; in that case, please share: ▪︎ Your Airbyte version (OSS vs Cloud, exact version) ▪︎ The full Terraform error (including the part after
error sending request: Post
) ▪︎ Your
airbyte
provider config (especially
server_url
and credentials) Without that extra runtime detail, I can’t be more specific than mapping your symptom to the known 1.8.5 custom source-definition issue described above. 👍 0 button 👎 0 button ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.