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"
| Argument | Type | Required | Description |
|---|---|---|---|
api_key | String | No | API key. Falls back to PLATFORMXE_API_KEY env var |
base_url | String | No | API 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"]
}
| Argument | Type | Required | Description |
|---|---|---|---|
name | String | Yes | Webhook display name |
url | String | Yes | Webhook delivery URL (HTTPS) |
events | List(String) | Yes | Events to subscribe to |
is_active | Bool | No | true (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." },
])
}
| Argument | Type | Required | Description |
|---|---|---|---|
name | String | Yes | Template name (unique within the organization) |
subject | String | Yes | Subject line (supports template variables) |
body_blocks_json | String (JSON) | Yes | Array 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
}
| Argument | Type | Required | Description |
|---|---|---|---|
name | String | Yes | Trigger name |
code | String | Yes | Unique across every trigger (a code in use fails with 409 DUPLICATE); changes in place |
trigger_config | Attributes | Yes | trigger_config = { ... } (an attribute, not a block): trigger_type (EVENT or SCHEDULE, required), event_type, cron_expression, entity_type, conditions (JSON object) |
actions | Attributes list | Yes | actions = [ { 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_day | No | Removing one clears it | |
is_active | Bool | No | Whether the trigger is active. Defaults to true |
source_app | String | No (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"
}
| Argument | Type | Required | Description |
|---|---|---|---|
domain | String | Yes | Domain 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"
}
| Argument | Type | Required | Description |
|---|---|---|---|
name | String | Yes | Subscription name (at least 3 characters) |
event_types | List(String) | Yes | Event types to subscribe to |
webhook_url | String | Yes | HTTPS URL to receive event notifications |
is_active | Bool | No | true (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"
})
}
| Argument | Type | Required | Description |
|---|---|---|---|
namespace | String | Yes | Must be on the org's allowlist (seeded with the org slug at onboarding). Forces replacement. |
name | String | Yes | Event name within the namespace (e.g. property.favorited). Forces replacement. |
version | String | Yes | Strict MAJOR.MINOR.PATCH. Forces replacement. |
status | String | No | draft / published / archived. Defaults to draft. |
description | String | No | Surfaced on the marketplace + portal. |
payload_schema | String | Yes | JSON Schema 2020-12 document, encoded as a string (jsonencode({...})). Forces replacement. |
payload_example | String | No | Example 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"]
}
| Argument | Type | Required | Description |
|---|---|---|---|
registration_id | String | Yes | Source platformxe_custom_event id. Must be owned by the calling org and status='published'. Forces replacement. |
title | String | Yes | Marketplace UI label. Min 3 chars. |
description | String | No | Longer description / use cases. |
tags | List(String) | No | Search/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 callclient.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 freshplatformxe_custom_eventregistration, 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"
}
| Argument | Type | Required | Description |
|---|---|---|---|
name | String | Yes | Owner-scope-unique label (3–80 chars). Forces replacement on change. |
description | String | No | Free-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
}
| Argument | Type | Required | Description |
|---|---|---|---|
group_id | String | Yes | Federation group id (a cuid2, no prefix). Forces replacement. |
registration_id | String | Yes | Source 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
}
| Argument | Type | Required | Description |
|---|---|---|---|
group_id | String | Yes | Federation group id. Forces replacement. |
label | String | Yes | Operator-friendly label. Forces replacement. |
webhook_url | String | Yes | HTTPS URL receiving signed POSTs. Forces replacement. |
headers | Map(String) | No | Static 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
}]
})
}
| Argument | Type | Required | Description |
|---|---|---|---|
slug | String | Yes | Channel slug (forces replacement) |
display_name | String | Yes | Human-readable name |
entity_type | String | Yes | Domain entity type (forces replacement) |
participant_roles | List(String) | Yes | Allowed participant roles |
default_visibility | List(String) | Yes | Default message visibility |
lifecycle_rules | String (JSON) | No | Auto-close and auto-archive rules |
escalation_config | String (JSON) | No | Flag reasons and escalation rules |
webhook_url | String | No | Webhook 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:
| Argument | Type | Required | Description |
|---|---|---|---|
enabled | Bool | No | Whether the processor is active. Defaults to true |
config | String (JSON) | No | Service-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
}
| Attribute | Type | Description |
|---|---|---|
id | String | Tenant organization ID |
name | String | Tenant display name |
slug | String | URL-safe slug |
plan | String | Current plan (FREE, BASIC, PRO, ENTERPRISE) |
billing_email | String | Billing contact email |
region | String | Tenant region |
is_active | Bool | Whether 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
}
| Argument | Type | Required | Description |
|---|---|---|---|
channel_id | String | Yes | Channel 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
| Resource | Description | Force replace on |
|---|---|---|
platformxe_webhooks_endpoint | Outbound webhook | -- |
platformxe_templates_template | Content template | -- |
platformxe_workflows_trigger | Event-driven workflow | -- |
platformxe_domains_sending | Sending domain | domain |
platformxe_events_subscription | Event subscription | -- |
platformxe_custom_event | Tenant custom event registration | namespace, name, version, payload_schema, payload_example |
platformxe_marketplace_listing | Custom-event marketplace listing (PRO+) | registration_id |
platformxe_event_federation_group | Custom Event Federation group (ENTERPRISE) | name |
platformxe_event_federation_push | Per-version event push declaration | group_id, registration_id |
platformxe_event_federation_external_peer | External webhook peer (Pattern 3, v1.5.0) | group_id, label, webhook_url |
platformxe_threads_channel | Thread channel | slug, entity_type |
platformxe_ocr_processor | OCR processor config | -- |
platformxe_pdf_processor | PDF processor config | -- |
platformxe_qr_processor | QR processor config | -- |
platformxe_messaging_processor | Messaging processor config | -- |
platformxe_storage_processor | Storage processor config | -- |
platformxe_exports_processor | Exports processor config | -- |
platformxe_identity_processor | Identity 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.