Terraform Provider

redirect.pizza provides an official Terraform Provider to maintain your redirects via IaaC. This provider provides a singular resource `redirectpizza_redirect` to control your redirects via code.

You can find our provider here: https://registry.terraform.io/providers/enflow/redirectpizza

Example usage

terraform {
  required_providers {
    redirectpizza = {
      source  = "github.com/enflow/redirectpizza"
    }
  }
}

# Set the variable value in *.tfvars file
# or using -var="rp_token=..." CLI option
variable "rp_token" {}

provider "redirectpizza" {
  token = var.rp_token
}

resource "redirectpizza_redirect" "old-domain" {
  sources = [
    "old-domain.com"
  ]
  destination {
    url = "new-domain.com"
  }

  # Optional
  # Must be one of:
  # - permanent
  # - permanent:307
  # - permanent:308
  # - temporary
  # - frame
  redirect_type = "permanent"

  # Optional
  tracking       = true
  uri_forwarding = true
  keep_query_string     = false
  tags                  = ["prod", "dev"]
}

More articles

Can’t find the answer you’re looking for?

E-mail us
support@redirect.pizza
Start a chat
Online 9:00 - 21:00 CEST
Phone
Available with Enterprise
Pricing Background
Domain redirects delivered hassle-free

Get started right away

  • Free plan
  • No creditcard required
Features

Everything
you need