Flag of Ukraine

Terraform Provider Plugin Terraform Provider Plugin

If you use HashiCorp's Terraform to provision your infrastructure, and are looking to deploy Transloadit as a part of that, you may find it interesting to know that you can bring Transloadit's Templates under the control of Terraform, so that along with your app, its encoding instructions can be provisioned in a reproducible way.

Install

You'll first need Terraform 0.12.x installed on your system as a prerequisite.

The recommended way to install the Transloadit Terraform Provider is to use binary distributions from the Releases page. The binaries are available for Linux, macOS (darwin) and Windows (all for the amd64 architecture).

Here's how to download and extract the latest release for your OS:

Linux

mkdir -p ~/.terraform.d/plugins/ && cd !$
curl -sSL https://github.com/transloadit/terraform-provider-transloadit/releases/download/v0.1.0/terraform-provider-transloadit_linux_amd64.tar.gz | tar xvz
cd -

macOS

mkdir -p ~/.terraform.d/plugins/ && cd !$
curl -sSL https://github.com/transloadit/terraform-provider-transloadit/releases/download/v0.1.0/terraform-provider-transloadit_darwin_amd64.tar.gz | tar xvz
cd -

Windows

Download and unpack the provider into %APPDATA%\terraform.d\plugins.

Usage

Here's a quick example. More detailed instructions can be found in the website directory. If you intend to use multiple Apps withing Transloadit, check out the examples how to structure that by passing one provider alias per App.

In main.tf:

provider "transloadit" {
  auth_key    = "<TRANSLOADIT-AUTH-KEY>"
  auth_secret = "<TRANSLOADIT-AUTH-SECRET>"
  version     = "0.1.0"
}

resource "transloadit_template" "my-terraform-template" {
  name     = "my-terraform-template"
  template = <<EOT
{
  "steps": {
    ":original": {
      "robot": "/upload/handle"
    },
    "encoded": {
      "use": ":original",
      "robot": "/video/encode",
      "preset": "ipad-high",
      "ffmpeg_stack": "v6.0.0"
    },
    "thumbed": {
      "use": ":original",
      "robot": "/video/thumbs",
      "count": 4,
      "ffmpeg_stack": "v6.0.0"
    },
    "exported": {
      "use": [ ":original", "encoded", "thumbed"],
      "credentials": "YOUR_S3_CREDENTIALS",
      "robot": "/s3/store"
    }
  }
}
EOT
}

output "my-terraform-template-id" {
  value = transloadit_template.my-terraform-template.id
}

Now on the CLI, run:

terraform init # only required on the first run after using a new Provider (version)
terraform plan

Documentation

See GitHub for the full documentation.