Trouble creating REST API connector through Terraform

Summary

When trying to create a REST API connector through Terraform, encountering an unknown status code 422 with an error message indicating ‘unprocessable-entity’. The provided configuration seems to be correct. Need assistance in resolving this issue.


Question

Hello. I am trying to create REST API connector throu terraform. On UI it works like a charm but when trying to create throu terraform i am getting :
unknown status code returned: Status 422 {"status":422,"type":"<https://reference.airbyte.com/reference/errors#unprocessable-entity>","title":"unprocessable-entity","detail":"The body of the request was notunderstood","documentationUrl":null,"data":null}

This is my config.What i am missing ? :

  name         = "Custom JSONPlaceholder Source"
  workspace_id = var.airbyte_workspace_id  # Your Airbyte workspace ID
  configuration = jsonencode({
    url = "<https://jsonplaceholder.typicode.com>",  
    http_method = "GET", 
    path = "/posts",  
    headers = {
      "User-Agent" = "python-requests/2.32.3",  # Example header
      "Accept"     = "*/*"                      # Example header
    },
    body = jsonencode({}),  # No body for GET requests
    primary_key = ["id"],  
    pagination_type = "None"
  })
}```

<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/p1729245827706689) if you want 
to access the original thread.

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

<sub>
["rest-api-connector", "terraform", "status-422", "unprocessable-entity", "airbyte-source-custom"]
</sub>

Did you build your connector in Connector Builder? That’s what you mean by REST API connector?

yes i used —>start from scratch and was able to create it throu UI but struggle to do the same with Terraform

It’s not possible with terraform provider at this moment.

In my project I have one connector built with Connector Builder. After publishing it, I found connector’s definition id in database and I configured source like this

  name = "My Connector"

  workspace_id = "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"

  definition_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"

  configuration = jsonencode({
    # ...
  })
}```
So at this moment, you need to manually configure connector in Connector Builder, then you can add source from terraform.

You can add your comment to this discussion <https://github.com/airbytehq/airbyte/issues/42990>
We need special endpoints first, so later it can be implemented in terraform provider.

<@U05JENRCF7C> i am fine with manuall publish of custom connector. But we are using 2 envs- is it possible to get definition id automatically for ex based on a connector name ? We dont want to hard code it .

you can always write some script that gets definition id from database