Manage Maple dashboards, alert rules, alert destinations, uptime monitors, scrape targets and API keys as Terraform resources, through the public v2 API.
User docs: maple.dev/docs/iac/terraform. Registry docs are
generated into docs/ from the schema descriptions and examples/.
| Resource | API |
|---|---|
maple_dashboard |
/v2/dashboards |
maple_alert_destination |
/v2/alerts/destinations |
maple_alert_rule |
/v2/alerts/rules |
maple_uptime_monitor |
/v2/uptime_monitors |
maple_scrape_target |
/v2/scrape_targets |
maple_api_key |
/v2/api_keys |
maple_ingest_keys (data) |
/v2/ingest_keys |
Every resource is one resourceDef in provider/resources.go:
a schema, its v2 collection path and a few per-attribute flags. generic_resource.go
does the CRUD for all of them: attribute names are the API's snake_case wire names, so the plan is sent
as the request body and the response is read back into state.
- JSON documents (dashboard widgets, uptime
config, alertthresholds) are strings written withjsonencode. State keeps the user's string while the API's object still contains everything it says, so defaults the API adds (an HTTP monitor'smethod) are not drift. Imports read the API's canonical form, which is byte-identical tojsonencodeoutput. - Write-only values (destination credentials, scrape
auth_credentials) are never returned by the API, so state keeps the configured value and outside changes to them cannot be detected. - Removing an optional attribute clears it: the update sends
null(or[]for lists). maple_api_key.rotateis a keeper. Changing it callsPOST /v2/api_keys/{id}/roll, which revokes the key and returns a replacement with a new ID and secret.
provideris the provider itself. It is exported so the Pulumi provider can wrap it with the Terraform bridge.fakeapiis an in-memory Maple v2 API with the real API's defaults, write-only fields and quirks. Both providers' tests run against it.
go test ./... # real terraform plan/apply/import against an in-process fake API
go generate ./... # regenerate docs/ after changing a schema or an example
go build -o ~/.terraform.d/plugins/terraform-provider-maple .To run a configuration against a local build, point a CLI config at the binary's directory:
# ~/.terraformrc
provider_installation {
dev_overrides { "mapletechlabs/maple" = "/Users/you/.terraform.d/plugins" }
direct {}
}then MAPLE_API_URL=https://api.localhost MAPLE_API_KEY=maple_ak_… terraform plan.
Versions come from @maple-dev/changesets. Add one with
npx changeset in any PR that changes what users get. The release workflow
keeps a "Version Packages" PR open; merging it tags vX.Y.Z and runs goreleaser, which signs the
checksums with the GPG key whose public half is registered on the Registry namespace (secrets
GPG_PRIVATE_KEY and PASSPHRASE). The Registry picks the release up from the webhook.
After a release, bump the provider in pulumi-maple and regenerate its SDKs.