Skip to content

mixpanel_formula (Resource)

Manages a Mixpanel formula metric (mixpanel_formula) — a saved metric that combines other metrics using mathematical expressions (uses the Mixpanel metrics API with type = "formula"; same endpoint family as mixpanel_metric).

Example Usage

resource "mixpanel_formula" "conversion" {
  name = "Purchase / Sign Up"
  type = "formula"
  definition = jsonencode({
    formula = {
      definition        = "A/B"
      referencedMetrics = []
    }
  })
}

Schema

Optional

  • contacts (List of String)
  • definition (String) jsonencode'd formula definition (see plan-time validation below).
  • description (String)
  • name (String)
  • owned_by (Attributes)
  • project_id (Number)
  • share_with_project (Boolean) Whether to share this entity with the whole project after creation. Defaults to true. See the Entity sharing guide.
  • type (String)
  • verified (Boolean)

Read-Only

  • created (String)
  • created_by (Attributes)
  • id (Number) The ID of this resource.
  • is_locked (Boolean)
  • is_visible (Boolean)
  • last_verified (String)
  • modified (String)

Plan-time validation of definition

Formula definitions are validated at terraform plan time with the same rules as mixpanel_metric wherever the definition carries behavior / measurement objects (see the metric resource docs); pure formula definitions ({ formula = { definition = "A/B", ... } }) pass through untouched.

Import

Formulas can be imported using the composite PROJECT_ID:ID format:

import {
  to = mixpanel_formula.conversion
  id = "1234567:890"
}
terraform import mixpanel_formula.conversion 1234567:890