Terraform provider for MXroute email hosting, built on the MXroute REST API. Manages domains, mailboxes, forwarders, catch-all behaviour, spam filtering, and (where the account is reseller-enabled) reseller packages and users.
Published on the Terraform Registry and the OpenTofu Registry as demon/mxroute.
terraform {
required_providers {
mxroute = {
source = "demon/mxroute"
version = "~> 0.5"
}
}
}Generate an API key at panel.mxroute.com/api-keys.php and configure the provider with three values, either as arguments or via environment variables (MXROUTE_SERVER, MXROUTE_USERNAME, MXROUTE_APIKEY).
provider "mxroute" {
server = "eagle.mxlogin.com"
username = "myusername"
apikey = "..." # prefer MXROUTE_APIKEY
}
resource "mxroute_domain" "example" {
name = "example.com"
}
resource "mxroute_mail_hosting" "example" {
domain = mxroute_domain.example.name
enabled = true
}Full schema and per-resource examples live under docs/ (also browsable on the Registry).
Requires the Go version pinned in go.mod.
make build # go build
make test # unit tests
make lint # golangci-lint
make generate # regenerate docs from schema + examplesAcceptance tests hit the live API and need TF_ACC=1 plus a dedicated test account:
export MXROUTE_SERVER=eagle.mxlogin.com
export MXROUTE_USERNAME=myusername
export MXROUTE_APIKEY=...
export MXROUTE_TEST_DOMAIN=test.example.com
make testaccSee CONTRIBUTING.md for the full workflow, including how to add a new resource. Security issues: see SECURITY.md.