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 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
Install a current Terraform CLI. Terraform selects the provider package for your platform from the Registry.
Create a working directory:
mkdir -p transloadit-terraform
cd transloadit-terraform
In that directory, create versions.tf with the
Transloadit Registry provider
requirement:
terraform {
required_providers {
transloadit = {
source = "transloadit/transloadit"
version = "~> 0.8.0"
}
}
}
This constraint selects compatible patch releases in the 0.8 series. terraform init, shown below,
installs the provider and records the selected version in .terraform.lock.hcl. Commit that lock
file with your configuration for reproducible installations. See Terraform’s
provider requirements
for version selection and upgrades.
Usage
Here's a quick example. More detailed instructions can be found in the website directory. If you intend to use multiple Apps within Transloadit, see the examples for how to configure one provider alias per App.
In main.tf:
provider "transloadit" {
auth_key = "<TRANSLOADIT-AUTH-KEY>"
auth_secret = "<TRANSLOADIT-AUTH-SECRET>"
}
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": "v7"
},
"thumbed": {
"use": ":original",
"robot": "/video/thumbs",
"count": 4,
"ffmpeg_stack": "v7"
},
"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
}
From the same directory, initialize the provider and preview the changes:
terraform init
terraform plan
Documentation
See GitHub for the full documentation.