Skip to content
Maple Docs
Open app

Terraform resources

Every resource and data source in the Maple Terraform provider: arguments, read-only attributes, import IDs and update behavior.

The resources the mapletechlabs/maple provider manages. New here? Start with the Terraform quick start.

ResourceLifecycleImport ID
maple_dashboardCreate, update in place, deletedash_…
maple_alert_destinationCreate, update in place, delete. Changing type replaces itdest_…
maple_alert_ruleCreate, update in place, deletealrt_…
maple_uptime_monitorCreate, update in place, delete. Changing config.type replaces itupm_…
maple_scrape_targetCreate, update in place, delete. Changing target_type replaces itscrp_…
maple_api_keyCreate, roll, revoke. Any other change replaces the keykey_…
maple_ingest_keysData source

Attribute names are the API’s snake_case wire names, as the interactive API reference documents the matching create endpoint. Attributes marked default take Maple’s value when you leave them out, and keep their last value if you remove them later; every other optional attribute is cleared in Maple when you remove it.

maple_dashboard

resource "maple_dashboard" "checkout" {
  name        = "Checkout"
  description = "Golden signals for the checkout flow"
  tags        = ["checkout"]
  time_range  = jsonencode({ type = "relative", value = "12h" })
  widgets = jsonencode([
    {
      id            = "error-rate"
      visualization = "chart"
      data_source   = { kind = "route", endpoint = "traces_timeseries" }
      display       = { title = "Error rate" }
      layout        = { x = 0, y = 0, w = 6, h = 4 }
    },
  ])
}
ArgumentTypeNotes
namestringRequired
descriptionstring
tagslist(string)
time_rangeJSONdefault. { type = "relative", value = "12h" } or an absolute start_time and end_time
widgetsJSONList of widget documents
sectionsJSONWidgets join one with section_id and tab_id; their layout is relative to the section’s grid
variablesJSONList of dashboard variables
refresh_interval_secondsnumber0, 5, 10, 30, 60, 300 or 900

The easiest way to get widget documents is to build the dashboard in Maple and import it. See Build dashboards.

maple_alert_destination

A notification channel that alert rules and uptime monitors deliver to. The fields depend on type:

typeFields
pagerdutyintegration_key
webhookurl, optional signing_secret
discordwebhook_url
telegrambot_token, chat_id
emailmember_user_ids
chatworkspace_id of a linked chat workspace, channel_id

Every type also takes name (required) and enabled (default true). Credentials are write-only: Terraform sends the value from your configuration on every update and cannot see changes made in Maple. Read-only: summary, channel_label.

See Notification destinations.

maple_alert_rule

resource "maple_alert_rule" "checkout_latency" {
  name           = "Checkout p95 latency"
  signal_type    = "p95_latency"
  comparator     = "gt"
  window_minutes = 10
  service_names  = ["checkout"]
  thresholds = jsonencode([
    { severity = "warning", value = 800, destination_ids = [maple_alert_destination.team.id] },
    { severity = "critical", value = 2000, destination_ids = [maple_alert_destination.oncall.id] },
  ])
}
ArgumentTypeNotes
namestringRequired, unique in the organization
signal_typestringRequired. error_rate, p95_latency, p99_latency, apdex, throughput, builder_query, raw_query, uptime
comparatorstringRequired. gt, gte, lt, lte, eq, neq, between, not_between
window_minutesnumberRequired, up to 1440
severity, thresholdstring, numberdefault. One threshold. Error rates are 0 to 1 ratios
thresholdsJSONdefault. Tiers of { severity, value, upper, recovery_value, destination_ids }
threshold_uppernumberUpper bound for between and not_between
destination_idslist(string)default. dest_… IDs
service_names, exclude_service_names, environments, group_bylist(string)Scope and split the rule
tagsset(string)Lowercase
notesstringIncluded in notifications
enabled, alert_on_no_databooldefault
minimum_sample_count, consecutive_breaches_required, consecutive_healthy_required, renotify_interval_minutesnumberdefault
evaluation_interval_minutes, breaches_out_ofnumber
apdex_threshold_msnumberapdex rules
query_builder_draftJSONbuilder_query rules
raw_query_sql, raw_query_reducerstringraw_query rules
notification_templateJSONCustom title and body, optional per-channel overrides

Maple checks the signal-specific fields against signal_type when you apply. See Alert rules.

maple_uptime_monitor

resource "maple_uptime_monitor" "nightly_backup" {
  name = "Nightly backup"
  config = jsonencode({
    type          = "heartbeat"
    schedule      = { type = "cron", expression = "0 3 * * *", timezone = "Europe/Berlin" }
    grace_seconds = 900
  })
  destination_ids = [maple_alert_destination.oncall.id]
}
ArgumentTypeNotes
namestringRequired
configJSONRequired. type is http, tcp, dns or heartbeat; see below
interval_secondsnumberdefault. 30 to 3600
failures_to_downnumberdefault. 1 to 10
service_namestringAttach the monitor to a service
enabledbooldefault true
destination_idslist(string)Notified when the monitor goes down or recovers
config.typeFields
httpurl, optional method (GET, HEAD, POST), headers, body, assertions, timeout_ms
tcphost, port, optional timeout_ms
dnshostname, record_type (A, AAAA, CNAME, MX, TXT, NS), optional expected
heartbeatschedule ({ type = "interval", seconds } or { type = "cron", expression, timezone }), grace_seconds

Read-only: kind, heartbeat_url (the URL a heartbeat job pings), alert_rule_id. See Uptime monitoring.

maple_scrape_target

resource "maple_scrape_target" "node_exporter" {
  name                    = "node-exporter"
  url                     = "https://metrics.example.com/metrics"
  scrape_interval_seconds = 30
  auth_type               = "bearer"
  auth_credentials        = var.metrics_token
}
ArgumentTypeNotes
namestringRequired
urlstringdefault. The metrics endpoint
target_typestringdefault prometheus. Also planetscale, supabase
scrape_interval_secondsnumberdefault. 5 to 300
auth_typestringdefault none. Also bearer, basic, token
auth_credentialsstringWrite-only
labels_jsonstringExtra labels, as a JSON object string
service_namestringservice.name for the scraped series
organization, include_branches, exclude_branchesstring, list(string)planetscale targets
enabledbooldefault true

See Prometheus.

maple_api_key

ArgumentTypeNotes
namestringRequired
descriptionstring
scopeslist(string)For example dashboards:read, alerts:write. Unset means full access
kindstringdefault standard. Also mcp
expires_in_secondsnumberUnset means the key does not expire
rotatestringAny value. Changing it rolls the key

Changing anything but rotate revokes the key and creates a new one. Read-only: secret (sensitive, stored in state), key_prefix, expires_at. Destroying the resource revokes the key.

maple_ingest_keys

data "maple_ingest_keys" "this" {}

Read-only: public_key and private_key (both sensitive), public_rotated_at, private_rotated_at. Needs an API key created by an org admin. See Authentication.