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"] }