Skip to content

mixpanel_service_account (Resource)

Manages a Mixpanel service account — a non-interactive account used for programmatic API access. Service accounts can be assigned organization or project roles and optionally configured with an expiration timestamp.

Example Usage

resource "mixpanel_service_account" "terraform" {
  organization_id = 7654321
  username        = "terraform-automation"
  role            = "admin"
  expires         = "2030-01-01T00:00:00Z"
}

Schema

Required

  • username (String)

Optional

  • expires (String) Expiration timestamp in the exact format 2006-01-02T15:04:05Z (UTC, trailing Z, no sub-seconds, no timezone offset). Leave unset for a non-expiring account. Validated at plan time; changing it forces a new service account (the API has no update operation).
  • organization_id (Number)
  • projects (Attributes List) (see below for nested schema)
  • role (String)
  • serviceaccount_id (Number)

Read-Only

  • created (String)
  • creator (Number)
  • creator_email (String)
  • creator_name (String)
  • id (Number) The ID of this resource.
  • last_used (String)
  • token (String)
  • user (Number)

Nested Schema for projects

Required:

  • id (Number)
  • role (String)

Expiration format

The Mixpanel API only accepts service-account expirations in the exact format %Y-%m-%dT%H:%M:%SZ (for example 2030-01-01T00:00:00Z) — UTC with a trailing Z, no sub-seconds, no timezone offsets, uppercase T/Z. Anything else is rejected with a 400. The provider validates the format at terraform plan time so a bad value never reaches the API. An unset/empty expires means the account never expires.

Import

Service accounts are organization-scoped. Import using the composite identifier ORGANIZATION_ID:SERVICE_ACCOUNT_ID:

import {
  to = mixpanel_service_account.terraform
  id = "7654321:987654"
}