Skip to content

About

Terraform provider for SendGrid (Twilio) — full API coverage, built on the Terraform Plugin Framework

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

1 watching

Forks

SendGrid Terraform Provider

A Terraform provider for managing SendGrid (Twilio) resources, built on the Terraform Plugin Framework.

Usage

The provider is published on the Terraform Registry as twilio-labs/sendgrid:

terraform {
  required_providers {
    sendgrid = {
      source = "twilio-labs/sendgrid"
    }
  }
}

provider "sendgrid" {
  # Or set the SENDGRID_API_KEY environment variable.
  api_key = var.sendgrid_api_key
}

See docs/guides/authentication.md for all provider configuration options (including EU data residency and On-Behalf-Of subuser access), and docs/guides/migrating-from-other-providers.md if you're coming from another SendGrid provider.

Resources

Access & Security

Account Management

Sender Authentication

Templates

Webhooks

Marketing Campaigns

Tracking & Mail Settings

IP Management

Partner Accounts

Most resources have a matching data source of the same name. The exceptions are sendgrid_template_version, sendgrid_ip_warmup, sendgrid_partner_account, and the account-wide Tracking & Mail Settings resources (there's nothing to look up by ID for a singleton setting). There is also a standalone sendgrid_partner_offerings data source. See docs/ for full reference documentation.

Development

Requirements:

go install

Or run everything CI runs in one shot (build, vet, lint, unit tests, docs generation):

make check

See CONTRIBUTING.md for the full workflow

Configuration for local development

Point Terraform at a locally-built copy of the provider using a dev override in ~/.terraformrc:

provider_installation {
  dev_overrides {
    "twilio-labs/sendgrid" = "/path/to/your/GOBIN"
  }
  direct {}
}

Then set credentials via environment variables (or the equivalent provider block attributes — see docs/guides/authentication.md):

Environment variable Purpose
SENDGRID_API_KEY Required. The SendGrid API key used to authenticate all requests.
SENDGRID_API_HOST Optional. Defaults to https://api.sendgrid.com; set for EU regional accounts.
SENDGRID_ON_BEHALF_OF Optional. Acts on behalf of a subuser or parent account on every request.

Testing

Unit tests (no credentials required):

go test ./...

Acceptance tests make real API calls against a live SendGrid account and will create/destroy real resources. They're gated behind TF_ACC and require a real API key:

TF_ACC=1 SENDGRID_API_KEY=SG.xxxx go test ./internal/provider/... -v

Generating documentation

Docs under docs/ are generated from resource/data-source schema descriptions, examples/, and templates/ via tfplugindocs. After changing a schema description or adding an example, regenerate with:

go generate ./...

License

Mozilla Public License v2.0

About

Terraform provider for SendGrid (Twilio) — full API coverage, built on the Terraform Plugin Framework

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages