Register Custom Drivers

A custom Driver is essentially a simple API service. Therefore, you need to notify Humanitec about how to consume it.

Notify Humanitec about the type of Driver, the types of account credentials supported, the Driver-specific input parameters (as a JSON Schema), whether to make the Driver publicly available, the URL that it can be accessed from, and give it an id.

Custom Driver example

Set the following environment variables for the CLI and API commands:

Variable Example Description
HUMANITEC_TOKEN my-token The authentication token for accessing the Humanitec API.
HUMANITEC_ORG my-org-id The unique identifier for the organization in Humanitec.

The CLI and API examples expect a Driver schema file in my_driver_schema.json.

Register a custom driver:

humctl api post /orgs/${HUMANITEC_ORG}/resources/drivers \
  -d '{
  "id": "demo-driver",
  "type": "s3",
  "account_types": [
    "aws"
  ],
  "inputs_schema": '"$(cat my_driver_schema.json)"',
  "is_public": false,
  "target": "https://drivers.example.com/s3/"
}'

Update a custom driver:

export DRIVER_ID="demo-driver"

humctl api put /orgs/${HUMANITEC_ORG}/resources/drivers/${DRIVER_ID} \
  -d '{
  "type": "s3",
  "account_types": [
    "aws"
  ],
  "inputs_schema": '"$(cat my_driver_schema.json)"',
  "is_public": false,
  "target": "https://drivers.example.com/s3/"
}'

Register a custom driver:

curl -X POST https://api.humanitec.io/orgs/${HUMANITEC_ORG}/resources/drivers \
   -H "Content-Type: application/json" \
   -H "Authorization: Bearer ${HUMANITEC_TOKEN}" \
   -d @- <<EOF
{
  "id": "demo-driver",
  "type": "s3",
  "account_types": [
    "aws"
  ],
  "inputs_schema": $(cat my_driver_schema.json),
  "is_public": false,
  "target": "https://drivers.example.com/s3/"
}
EOF

Update a custom driver:

export DRIVER_ID="demo-driver"

curl -X PUT https://api.humanitec.io/orgs/${HUMANITEC_ORG}/resources/drivers/${DRIVER_ID} \
   -H "Content-Type: application/json" \
   -H "Authorization: Bearer ${HUMANITEC_TOKEN}" \
   -d @- <<EOF
{
  "type": "s3",
  "account_types": [
    "aws"
  ],
  "inputs_schema": $(cat my_driver_schema.json),
  "is_public": false,
  "target": "https://drivers.example.com/s3/"
}
EOF

Use the humanitec_resource_driver Resource of the Humanitec Terraform Provider to manage custom drivers. An example usage can be found in the provider documentation .

Top