Using Providers

The following will explain how to add a provider to Terrakube.

Lets add the random provider version 3.0.1 to terrakube, we can get the information that we need from the following endpoints:

GET https://registry.terraform.io/v1/providers/hashicorp/random/versions
GET https://registry.terraform.io/v1/providers/hashicorp/random/3.0.1/download/linux/amd64

Create the provider inside the organization:

POST https://terrakube-api.minikube.net/api/v1/organization/d9b58bd3-f3fc-4056-a026-1163297e80a8/provider
Content-Type: application/vnd.api+json
Authorization: Bearer (PAT TOKEN)
{
    "data": {
        "type": "provider",
        "attributes": {
          "name": "random",
          "description": "random provider"
        }
    }
}

Create the provider version

POST https://terrakube-api.minikube.net/api/v1/organization/d9b58bd3-f3fc-4056-a026-1163297e80a8/provider/950ce3fd-3f11-46e4-8ef2-34ec3718de3e/version
Content-Type: application/vnd.api+json
Authorization: Bearer (PAT TOKEN)
{
    "data": {
        "type": "version",
        "attributes": {
          "versionNumber": "3.0.1",
          "protocols": "5.0"
        }
    }
}

Create the provider implementation

You can change the URL from the above paramaters and use a URL that you control, I was using the terraform registry url for example purposes

Now in your terraform code you can have something like this:

And when running terraform init you will see something like:

Was this helpful?