A Terraform provider for managing Resend resources — API keys, sending domains, and webhooks.
terraform {
required_providers {
resend = {
source = "jhoward321/resend"
}
}
}
provider "resend" {
api_key = var.resend_api_key # or set RESEND_API_KEY env var
}resource "resend_api_key" "production" {
name = "production"
permission = "sending_access"
domain_id = resend_domain.example.id
}resource "resend_domain" "example" {
name = "mail.example.com"
region = "us-east-1"
}
# DNS records are available as computed attributes
output "dns_records" {
value = resend_domain.example.records
}resource "resend_webhook" "delivery_events" {
url = "https://example.com/webhooks/resend"
event_types = ["email.sent", "email.delivered", "email.bounced"]
}The provider requires a Resend API key. You can provide it in two ways:
- Set the
api_keyattribute in the provider block - Set the
RESEND_API_KEYenvironment variable
| Resource | Description |
|---|---|
resend_api_key |
Create and delete API keys. The key token is stored in state as a sensitive value. |
resend_domain |
Register sending domains. Returns DNS records needed for verification. |
resend_webhook |
Configure webhook endpoints with specific event type subscriptions. Supports in-place updates. |
git clone https://github.com/jake/terraform-provider-resend.git
cd terraform-provider-resend
make buildUnit tests (no API key required):
make testAcceptance tests (requires a Resend API key):
RESEND_API_KEY=re_xxx make testaccReleases are automated via GitHub Actions.
Via git tag:
git tag v0.1.0
git push origin v0.1.0Via GitHub UI:
Go to Actions → Release → Run workflow, enter the version tag (e.g., v0.1.0).
Both methods run acceptance tests before building. If tests pass, GoReleaser creates a signed GitHub Release that the Terraform Registry syncs automatically.
- Generate a GPG key:
gpg --full-generate-key - Export the private key:
gpg --armor --export-secret-keys <KEY_ID> - Add these GitHub repo secrets:
GPG_PRIVATE_KEY— the exported private keyPASSPHRASE— the GPG key passphraseRESEND_API_KEY— Resend API key for acceptance tests
- Add the public key to registry.terraform.io under your account settings
- Link the repo on the Terraform Registry via Publish → Provider