Skip to content

mixpanel_custom_roles (Data Source)

Lists all Mixpanel custom roles in a project. Custom roles are named sets of permissions that can be assigned to organization members to define granular access controls.

Example Usage

data "mixpanel_custom_roles" "all" {
  project_id = 1234567
}

The ids attribute contains raw server identifiers. The import_ids attribute contains composite <project_id>:<role_id> identifiers ready to use in bulk import patterns (see the import guide).

Bulk import with for_each

Adopt every custom role in the project in one pass: the list data source's import_ids feed a for_each import block, and -generate-config-out scaffolds each resource body for review before you apply.

data "mixpanel_custom_roles" "all" {}

# One import per custom role. Both for_each iterate import_ids, so the import block
# and the resource address share the same instance key.
import {
  for_each = toset(data.mixpanel_custom_roles.all.import_ids)
  to       = mixpanel_custom_role.this[each.key]
  id       = each.value
}

resource "mixpanel_custom_role" "this" {
  for_each = toset(data.mixpanel_custom_roles.all.import_ids)
  # Body scaffolded by `terraform plan -generate-config-out=generated.tf`,
  # then reviewed and edited before apply.
}

Run terraform plan -generate-config-out=generated.tf, review the generated configuration, then terraform apply to import every custom role. Set project_id on the data source to target a non-default project. See the import guide for gotchas (write-only fields, normalization drift).

Schema

Optional

  • project_id (Number) Project id. Falls back to the provider default project.

Read-Only

  • ids (List of String) Raw ids of every custom_role in the project.
  • import_ids (List of String) <project_id>:<id> composite import ids for every custom_role.