Skip to content

mixpanel_email_digests (Data Source)

Lists every Mixpanel email digest in a project — use it to discover digest IDs and to bulk-import with for_each. See also mixpanel_email_digest data source and mixpanel_email_digest resource.

Example Usage

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

Returns ids (list of raw email digest IDs) and import_ids (list of PROJECT_ID:DIGEST_ID composites ready to feed for_each import blocks). See the import guide for the bulk-import pattern.

Bulk import with for_each

Adopt every email digest 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_email_digests" "all" {}

# One import per email digest. 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_email_digests.all.import_ids)
  to       = mixpanel_email_digest.this[each.key]
  id       = each.value
}

resource "mixpanel_email_digest" "this" {
  for_each = toset(data.mixpanel_email_digests.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 email digest. 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 (String) Project id. Falls back to the provider default project.

Read-Only

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