PlatformXeDocs
Get API Key

Terraform Provider

Manage PlatformXe infrastructure as code with Terraform -- configuration resources, processor types and data sources.

Terraform Provider

The Terraform provider is available exclusively to paid tenants (Basic, Pro, and Enterprise plans). Create an account at platformxe.com/portal/register and upgrade your plan to access the provider binary and registry credentials.

The PlatformXe Terraform provider lets you manage your entire PlatformXe tenant configuration as infrastructure-as-code. This guide covers 18 resources (11 configuration + 7 processor types) and 3 data sources. The Authorization resources (6) and their data source, and the Fraud Detection resources (2), are documented on pages available on request.

Installation

Add the provider to your Terraform configuration and run terraform init:

terraform {
  required_providers {
    platformxe = {
      source  = "calderaxe/platformxe"
      version = "~> 1.0"
    }
  }
}

Provider configuration

Authenticate via the provider block or the PLATFORMXE_API_KEY environment variable:

provider "platformxe" {
  api_key = var.platformxe_api_key
}
# Or use an environment variable
export PLATFORMXE_API_KEY="pxk_live_your_key_here"
ArgumentTypeRequiredDescription
api_keyStringNoAPI key. Falls back to PLATFORMXE_API_KEY env var
base_urlStringNoAPI base URL. Defaults to https://platformxe.com

Configuration resources (11)

The six platformxe_permissions_* resources and the permission modules data source are documented, with examples, in Terraform Authorization Resources (access on request), available on request; each resource's schema is on the Terraform Registry.

platformxe_webhooks_endpoint

Manages an outbound webhook endpoint.

resource "platformxe_webhooks_endpoint" "slack_alerts" {
  name   = "Slack Alerts"
  url    = "https://hooks.slack.com/services/xxx"
  events = ["INVOICE_PAID", "ORGANIZATION_CREATED"]
}
ArgumentTypeRequiredDescription
nameStringYesWebhook display name
urlStringYesWebhook delivery URL (HTTPS)
eventsList(String)YesEvents to subscribe to
is_activeBoolNotrue (default) keeps the endpoint ACTIVE; false pauses it (status PAUSED)

Computed attributes: id, secret (signing secret generated by PlatformXe, returned once at creation).

platformxe_templates_template

Manages a content template for email, SMS, or notifications.

resource "platformxe_templates_template" "welcome" {
  name    = "Welcome Email"
  subject = "Welcome to {{company_name}}"
  body_blocks_json = jsonencode([
    { type = "heading", content = "Welcome, {{name}}!", level = 1 },
    { type = "text", content = "Thanks for joining." },
  ])
}
ArgumentTypeRequiredDescription
nameStringYesTemplate name (unique within the organization)
subjectStringYesSubject line (supports template variables)
body_blocks_jsonString (JSON)YesArray of body blocks. type is text, heading, button, image, divider or spacer, with content, level, label, url, src, alt, height as that type needs

Computed attributes: id. Import by ID: terraform import platformxe_templates_template.welcome <id>.

platformxe_workflows_trigger

Manages a workflow trigger: when it fires (an event or a schedule), its conditions, and its actions.

resource "platformxe_workflows_trigger" "invoice_notify" {
  name = "Invoice Payment Notification"
  code = "PAYMENT_RECEIVED_NOTIFY"

  trigger_config = {
    trigger_type = "EVENT"
    event_type   = "PAYMENT_RECEIVED"
    conditions   = jsonencode({ amount = { gte = 100000 } })
  }

  actions = [
    {
      type   = "WEBHOOK"
      config = jsonencode({ url = "https://yourapp.com/hooks/invoice-paid" })
    },
  ]
  is_active = true
}
ArgumentTypeRequiredDescription
nameStringYesTrigger name
codeStringYesUnique across every trigger (a code in use fails with 409 DUPLICATE); changes in place
trigger_configAttributesYestrigger_config = { ... } (an attribute, not a block): trigger_type (EVENT or SCHEDULE, required), event_type, cron_expression, entity_type, conditions (JSON object)
actionsAttributes listYesactions = [ { type, config } ]: type is upper case (SEND_EMAIL, WEBHOOK, CREATE_ISSUE, ...), config a JSON object sent as the action's config
description, priority, cooldown_minutes, max_executions_dayNoRemoving one clears it
is_activeBoolNoWhether the trigger is active. Defaults to true
source_appStringNo (computed)Leave it out: set to your key's caller service. It cannot change after create

Every argument but source_app changes in place (the trigger keeps its id and executions). Destroy switches the trigger off (the API has no hard delete) and its code stays reserved; import it to manage it again. For the same reason terraform apply -replace or a tainted trigger fails with 409 DUPLICATE on the re-create: change arguments in place instead. An EVENT trigger needs event_type. From provider 1.5.3; earlier versions could not create a working trigger, and no earlier version could load its schema in Terraform (the processor resources' provider attribute, now provider_name).

platformxe_domains_sending

Manages a sending domain for email delivery.

resource "platformxe_domains_sending" "main" {
  domain = "notifications.myapp.com"
}
ArgumentTypeRequiredDescription
domainStringYesDomain name (forces replacement on change)

Computed attributes: id, verified (Bool), dns_records (JSON string of required DNS records).

platformxe_events_subscription

Manages an event subscription that forwards matching events to a webhook URL.

resource "platformxe_events_subscription" "audit_events" {
  name        = "audit-events"
  event_types = ["ROLE_CREATED", "ROLE_UPDATED", "ROLE_DELETED"]
  webhook_url = "https://audit.myapp.com/events"
}
ArgumentTypeRequiredDescription
nameStringYesSubscription name (at least 3 characters)
event_typesList(String)YesEvent types to subscribe to
webhook_urlStringYesHTTPS URL to receive event notifications
is_activeBoolNotrue (default) keeps the subscription ACTIVE; false pauses it (status PAUSED)

Computed attributes: id, secret (sensitive signing secret, returned once at creation — empty after an import).

platformxe_custom_event (v1.2.0)

Registers a tenant-defined custom event with the events engine. Schemas are immutable per (namespace, name, version) — bump the version to evolve a shape.

resource "platformxe_custom_event" "property_favorited" {
  namespace = "lettings"
  name      = "property.favorited"
  version   = "1.0.0"
  status    = "published"

  description = "Tenant added a property to their favorites list."

  payload_schema = jsonencode({
    type     = "object"
    required = ["propertyId", "userId"]
    properties = {
      propertyId = { type = "string" }
      userId     = { type = "string" }
    }
  })

  payload_example = jsonencode({
    propertyId = "p_1"
    userId     = "u_1"
  })
}
ArgumentTypeRequiredDescription
namespaceStringYesMust be on the org's allowlist (seeded with the org slug at onboarding). Forces replacement.
nameStringYesEvent name within the namespace (e.g. property.favorited). Forces replacement.
versionStringYesStrict MAJOR.MINOR.PATCH. Forces replacement.
statusStringNodraft / published / archived. Defaults to draft.
descriptionStringNoSurfaced on the marketplace + portal.
payload_schemaStringYesJSON Schema 2020-12 document, encoded as a string (jsonencode({...})). Forces replacement.
payload_exampleStringNoExample payload (JSON string). Validated against payload_schema at register time.

Computed: id (cer_…), canonical_name (TENANT_CUSTOM:<orgId>:<ns>.<name>@<version>), schema_hash, created_at, updated_at.

platformxe_marketplace_listing (v1.3.0, PRO+)

Publishes a registered custom event to the cross-tenant marketplace so other PlatformXe tenants can browse + fork it into their own org.

resource "platformxe_marketplace_listing" "property_favorited" {
  registration_id = platformxe_custom_event.property_favorited.id
  title           = "Property Favorited"
  description     = "Emit when a tenant adds a property to their favorites list."

  tags = ["lettings", "engagement", "property"]
}
ArgumentTypeRequiredDescription
registration_idStringYesSource platformxe_custom_event id. Must be owned by the calling org and status='published'. Forces replacement.
titleStringYesMarketplace UI label. Min 3 chars.
descriptionStringNoLonger description / use cases.
tagsList(String)NoSearch/filter tokens.

Computed: id (mkl_…), namespace, name, version, source_canonical_name, status (published / unpublished / archived), fork_count, published_at.

Note: Republishing an unpublished listing is intentionally out-of-scope for the v1 resource — rotate by terraform destroy + apply, or use the runtime call client.events.custom.marketplace.republish() for in-place re-activation. Forking is also a runtime call (client.events.custom.marketplace.fork()); the forked event is created in the calling org as a fresh platformxe_custom_event registration, not as a marketplace listing.

platformxe_event_federation_group

Manages a Custom Event Federation group (ENTERPRISE only). Owners create groups, declare per-version pushes against them, and attach members. Distinct from permission federation (an Authorization resource).

resource "platformxe_event_federation_group" "partners" {
  name        = "Trusted partners"
  description = "Lettings partners receiving live property events"
}
ArgumentTypeRequiredDescription
nameStringYesOwner-scope-unique label (3–80 chars). Forces replacement on change.
descriptionStringNoFree-text purpose.

Computed: id, owner_organization_id, created_by, created_at, updated_at, archived_at.

platformxe_event_federation_push

Declares a per-version push of one of the owner's custom event registrations into a group. Owner-only.

resource "platformxe_event_federation_push" "favorited" {
  group_id        = platformxe_event_federation_group.partners.id
  registration_id = platformxe_custom_event.property_favorited.id
}
ArgumentTypeRequiredDescription
group_idStringYesFederation group id (a cuid2, no prefix). Forces replacement.
registration_idStringYesSource custom-event registration id (cer_…). Must be owned by the calling org and status='published'. Forces replacement.

Computed: id, source_organization_id, namespace, name, version, source_canonical_name, is_active, pushed_by, pushed_at.

platformxe_event_federation_external_peer (v1.5.0 — Pattern 3)

Adds an external (non-tenant) peer to a Custom Event Federation group, addressed by webhook URL. The peer receives the same relays as a tenant_org member, signed with an HMAC-SHA256 secret returned only at create time.

resource "platformxe_event_federation_external_peer" "bookingcom" {
  group_id    = platformxe_event_federation_group.partners.id
  label       = "Booking.com"
  webhook_url = "https://booking.example.com/inbound/platformxe"

  headers = {
    Authorization = var.bookingcom_inbound_token
  }
}

# Encrypt your state at rest — `secret` is shown ONLY at create time.
output "bookingcom_signing_secret" {
  value     = platformxe_event_federation_external_peer.bookingcom.secret
  sensitive = true
}
ArgumentTypeRequiredDescription
group_idStringYesFederation group id. Forces replacement.
labelStringYesOperator-friendly label. Forces replacement.
webhook_urlStringYesHTTPS URL receiving signed POSTs. Forces replacement.
headersMap(String)NoStatic headers sent on every relay (e.g. Authorization): at most 10, no hop-by-hop or X-Caldera-* names, no CR/LF, at most 1 KiB each. Sensitive; values are sealed server-side (key-management envelope, bound to the peer, wiped when it is removed) and only the NAMES are echoed back, to the owner.

Computed: id, secret (sensitive — store immediately, cannot be retrieved later), status (always accepted for external peers), external_header_names, invited_by, invited_at.

Rotation: the API does not expose an in-place rotation endpoint. To rotate the HMAC secret, destroy and re-create the resource (terraform taint + apply, or remove + re-add).

platformxe_threads_channel

Manages an entity-scoped conversation channel with lifecycle rules and escalation configuration.

resource "platformxe_threads_channel" "booking" {
  slug               = "booking"
  display_name       = "Booking Conversations"
  entity_type        = "BOOKING"
  participant_roles  = ["GUEST", "HOST", "PLATFORM"]
  default_visibility = ["ALL"]

  lifecycle_rules = jsonencode({
    autoClose   = { onEntityStatus = ["CHECKED_OUT", "CANCELLED"] }
    autoArchive = { afterClosedDays = 90 }
  })

  escalation_config = jsonencode({
    flagReasons = [
      { code = "SAFETY", label = "Safety concern", severity = "HIGH" },
      { code = "DISPUTE", label = "Dispute", severity = "MEDIUM" },
      { code = "REFUND", label = "Refund request", severity = "LOW" },
    ]
    rules = [{
      id         = "rule-safety"
      name       = "Safety auto-escalation"
      trigger    = "PARTICIPANT_FLAG"
      conditions = { "in" = [{ "var" = "flag.reason" }, ["SAFETY"]] }
      actions    = [{ type = "CREATE_ISSUE", config = { title = "SAFETY: {{thread.subject}}", priority = "URGENT" } }]
      priority   = 1
      isActive   = true
    }]
  })
}
ArgumentTypeRequiredDescription
slugStringYesChannel slug (forces replacement)
display_nameStringYesHuman-readable name
entity_typeStringYesDomain entity type (forces replacement)
participant_rolesList(String)YesAllowed participant roles
default_visibilityList(String)YesDefault message visibility
lifecycle_rulesString (JSON)NoAuto-close and auto-archive rules
escalation_configString (JSON)NoFlag reasons and escalation rules
webhook_urlStringNoWebhook for thread events

Channels are deactivated on destroy (not deleted) to preserve existing threads and messages.


Processor resources (7)

Processor resources configure service-level runtime settings for your organization. Each processor controls a specific PlatformXe service.

platformxe_ocr_processor

resource "platformxe_ocr_processor" "config" {
  enabled = true
  config = jsonencode({
    confidenceThreshold    = 0.85
    supportedDocumentTypes = ["NIN_SLIP", "DRIVERS_LICENSE", "VOTERS_CARD"]
  })
}

platformxe_pdf_processor

resource "platformxe_pdf_processor" "config" {
  enabled = true
  config = jsonencode({
    defaultPageSize = "A4"
    defaultMargins  = { top = 20, right = 15, bottom = 20, left = 15 }
  })
}

platformxe_qr_processor

resource "platformxe_qr_processor" "config" {
  enabled = true
  config = jsonencode({
    defaultSize   = 300
    defaultFormat = "svg"
    brandColor    = "#102a4a"
  })
}

platformxe_messaging_processor

resource "platformxe_messaging_processor" "config" {
  enabled = true
  config = jsonencode({
    retryMaxAttempts = 3
    retryDelayMs     = 2000
    deadLetterAfter  = 5
  })
}

platformxe_storage_processor

resource "platformxe_storage_processor" "config" {
  enabled = true
  config = jsonencode({
    maxFileSizeMb      = 25
    allowedMimeTypes   = ["image/jpeg", "image/png", "application/pdf"]
    moderationEnabled  = true
  })
}

platformxe_exports_processor

resource "platformxe_exports_processor" "config" {
  enabled = true
  config = jsonencode({
    maxConcurrentJobs = 3
    retentionDays     = 30
  })
}

platformxe_identity_processor

resource "platformxe_identity_processor" "config" {
  enabled = true
  config = jsonencode({
    retryOnFailure   = true
    maxRetries       = 3
    cacheResolutions = true
    cacheTtlSeconds  = 86400
  })
}

All processor resources share the same argument schema:

ArgumentTypeRequiredDescription
enabledBoolNoWhether the processor is active. Defaults to true
configString (JSON)NoService-specific configuration object

Data sources (3)

data.platformxe_tenant

Read-only tenant details, resolved from the API key on the provider block. No arguments required.

data "platformxe_tenant" "me" {}

output "tenant_plan" {
  value = data.platformxe_tenant.me.plan
}
AttributeTypeDescription
idStringTenant organization ID
nameStringTenant display name
slugStringURL-safe slug
planStringCurrent plan (FREE, BASIC, PRO, ENTERPRISE)
billing_emailStringBilling contact email
regionStringTenant region
is_activeBoolWhether the tenant is active

data.platformxe_identity_providers

Check identity resolution provider health.

data "platformxe_identity_providers" "health" {}

output "providers" {
  value = data.platformxe_identity_providers.health.providers[*].name
}

Attributes: providers (list) with id, name, type, status per provider.

data.platformxe_threads_escalation_config

Read the escalation configuration for a thread channel.

data "platformxe_threads_escalation_config" "booking" {
  channel_id = platformxe_threads_channel.booking.id
}

output "flag_reasons" {
  value = jsondecode(data.platformxe_threads_escalation_config.booking.config).flagReasons[*].code
}
ArgumentTypeRequiredDescription
channel_idStringYesChannel ID to read escalation config from

Attributes: config (JSON string of the full escalation configuration).


Complete example

A full configuration showing cross-resource references with the correct resource names:

terraform {
  required_providers {
    platformxe = {
      source  = "calderaxe/platformxe"
      version = "~> 1.0"
    }
  }
}

provider "platformxe" {
  api_key = var.platformxe_api_key
}

variable "platformxe_api_key" {
  type      = string
  sensitive = true
}

# ── Data sources ──────────────────────────────────────────────────────────────

data "platformxe_tenant" "me" {}

output "tenant_plan" {
  value = data.platformxe_tenant.me.plan
}

# ── Messaging and delivery ───────────────────────────────────────────────────

resource "platformxe_domains_sending" "main" {
  domain = "notifications.myapp.com"
}

resource "platformxe_templates_template" "welcome" {
  name    = "Welcome Email"
  subject = "Welcome to {{company_name}}"
  body_blocks_json = jsonencode([
    { type = "heading", content = "Welcome, {{name}}!", level = 1 },
    { type = "text", content = "Thanks for joining." },
  ])
}

resource "platformxe_webhooks_endpoint" "slack_alerts" {
  name   = "Slack Alerts"
  url    = "https://hooks.slack.com/services/xxx"
  events = ["INVOICE_PAID", "ORGANIZATION_CREATED"]
}

# ── Events and workflows ────────────────────────────────────────────────────

resource "platformxe_events_subscription" "audit_events" {
  name        = "audit-events"
  event_types = ["ROLE_CREATED", "ROLE_UPDATED", "ROLE_DELETED"]
  webhook_url = "https://audit.myapp.com/events"
}

resource "platformxe_workflows_trigger" "invoice_notify" {
  name = "Invoice Payment Notification"
  code = "PAYMENT_RECEIVED_NOTIFY"

  trigger_config = {
    trigger_type = "EVENT"
    event_type   = "PAYMENT_RECEIVED"
  }

  actions = [
    {
      type   = "WEBHOOK"
      config = jsonencode({ url = platformxe_webhooks_endpoint.slack_alerts.url })
    },
  ]
}

# ── Contextual Messaging ────────────────────────────────────────────────────

resource "platformxe_threads_channel" "booking" {
  slug               = "booking"
  display_name       = "Booking Conversations"
  entity_type        = "BOOKING"
  participant_roles  = ["GUEST", "HOST", "PLATFORM"]
  default_visibility = ["ALL"]

  lifecycle_rules = jsonencode({
    autoClose   = { onEntityStatus = ["CHECKED_OUT", "CANCELLED"] }
    autoArchive = { afterClosedDays = 90 }
  })

  escalation_config = jsonencode({
    flagReasons = [
      { code = "SAFETY", label = "Safety concern", severity = "HIGH" },
    ]
    rules = [{
      id         = "rule-safety"
      name       = "Safety auto-escalation"
      trigger    = "PARTICIPANT_FLAG"
      conditions = { "in" = [{ "var" = "flag.reason" }, ["SAFETY"]] }
      actions    = [{ type = "CREATE_ISSUE", config = { title = "SAFETY: {{thread.subject}}", priority = "URGENT" } }]
      priority   = 1
      isActive   = true
    }]
  })
}

# ── Processors ──────────────────────────────────────────────────────────────

resource "platformxe_messaging_processor" "config" {
  enabled = true
  config  = jsonencode({ retryMaxAttempts = 3, deadLetterAfter = 5 })
}

resource "platformxe_storage_processor" "config" {
  enabled = true
  config  = jsonencode({ maxFileSizeMb = 25, moderationEnabled = true })
}

resource "platformxe_ocr_processor" "config" {
  enabled = true
  config  = jsonencode({ confidenceThreshold = 0.85 })
}

resource "platformxe_pdf_processor" "config" {
  enabled = true
  config  = jsonencode({ defaultPageSize = "A4" })
}

resource "platformxe_qr_processor" "config" {
  enabled = true
  config  = jsonencode({ defaultSize = 300, defaultFormat = "svg" })
}

resource "platformxe_exports_processor" "config" {
  enabled = true
  config  = jsonencode({ maxConcurrentJobs = 3, retentionDays = 30 })
}

resource "platformxe_identity_processor" "config" {
  enabled = true
  config  = jsonencode({ retryOnFailure = true, maxRetries = 3 })
}

Import existing resources

Import resources already created in the PlatformXe dashboard or portal:

# Delivery
terraform import platformxe_webhooks_endpoint.slack_alerts wh_abc123
terraform import platformxe_templates_template.welcome tmpl_abc123
terraform import platformxe_domains_sending.main dom_abc123
terraform import platformxe_events_subscription.audit_events esub_abc123

# Workflows
terraform import platformxe_workflows_trigger.invoice_notify trg_abc123

# Contextual Messaging
terraform import platformxe_threads_channel.booking ch_abc123

All resources support import using their PlatformXe ID.

Resource reference

ResourceDescriptionForce replace on
platformxe_webhooks_endpointOutbound webhook--
platformxe_templates_templateContent template--
platformxe_workflows_triggerEvent-driven workflow--
platformxe_domains_sendingSending domaindomain
platformxe_events_subscriptionEvent subscription--
platformxe_custom_eventTenant custom event registrationnamespace, name, version, payload_schema, payload_example
platformxe_marketplace_listingCustom-event marketplace listing (PRO+)registration_id
platformxe_event_federation_groupCustom Event Federation group (ENTERPRISE)name
platformxe_event_federation_pushPer-version event push declarationgroup_id, registration_id
platformxe_event_federation_external_peerExternal webhook peer (Pattern 3, v1.5.0)group_id, label, webhook_url
platformxe_threads_channelThread channelslug, entity_type
platformxe_ocr_processorOCR processor config--
platformxe_pdf_processorPDF processor config--
platformxe_qr_processorQR processor config--
platformxe_messaging_processorMessaging processor config--
platformxe_storage_processorStorage processor config--
platformxe_exports_processorExports processor config--
platformxe_identity_processorIdentity processor config--

Authorization and Fraud Detection

The six platformxe_permissions_* resources and the permission modules data source are documented, with examples, in Terraform Authorization Resources (access on request), available on request; each resource's schema is on the Terraform Registry.

The two platformxe_fraud_* resources are documented in the Fraud Detection docs (access on request), available on request; each resource's schema is on the Terraform Registry.