Terraform Provider
Use Terraform to manage Activations resources as infrastructure as code
The Activations Terraform Provider allows you to manage Activations resources programmatically using infrastructure as code (IaC). This enables you to version control, automate, and reproducibly deploy your Activations configurations across different environments.
Why use Terraform with Activations?
- Version Control - Track changes to your Activations configuration in Git alongside your other infrastructure code
- Reproducibility - Replicate configurations across development, staging, and production environments
- Automation - Integrate Activations configuration into your CI/CD pipelines
- Collaboration - Review and approve infrastructure changes through standard pull request workflows
- Multi-region Support - Manage Activations resources across US, EU, and AU regions
Getting Started
Installation
The Activations (formerly Census) Terraform Provider is available in the Terraform Registry. Add it to your Terraform configuration:
terraform {
required_providers {
census = {
source = "sutrolabs/census"
version = "~> 0.2.0"
}
}
}
provider "census" {
personal_access_token = var.census_personal_token
region = "us" # or "eu", "au"
}
Authentication
The provider requires a Activations personal access token. You can generate one from your Activations settings. We recommend storing the token in an environment variable or using a secrets management system:
export CENSUS_PERSONAL_ACCESS_TOKEN="your-token-here"
The provider will automatically detect the CENSUS_PERSONAL_ACCESS_TOKEN environment variable.
Basic Example
Here's a simple example of managing a Activations workspace with Terraform:
resource "census_workspace" "data_team" {
name = "Data Team Workspace"
notification_emails = ["data-alerts@company.com"]
return_workspace_api_key = true
}
resource "census_source" "warehouse" {
workspace_id = census_workspace.data_team.id
name = "Production Warehouse"
type = "snowflake"
connection_config = {
account = "xy12345.us-east-1"
database = "ANALYTICS"
warehouse = "COMPUTE_WH"
role = "CENSUS_ROLE"
username = "census_user"
password = var.snowflake_password
}
}
resource "census_sync" "users_to_crm" {
workspace_id = census_workspace.data_team.id
label = "Users to CRM"
source_attributes {
connection_id = census_source.warehouse.id
object {
type = "table"
table_name = "users"
table_schema = "public"
}
}
destination_attributes {
connection_id = census_destination.crm.id
object = "Contact"
}
operation = "upsert"
field_mapping {
from = "email"
to = "Email"
is_primary_identifier = true
}
field_mapping {
from = "first_name"
to = "FirstName"
}
run_mode {
type = "triggered"
triggers {
schedule {
frequency = "daily"
hour = 8
minute = 0
}
}
}
}
Available Resources
- census_workspace - Manage Activations workspaces
- census_source - Data warehouse connections (Snowflake, BigQuery, Postgres, etc.)
- census_destination - Business tool integrations (Salesforce, HubSpot, etc.)
- census_dataset - SQL datasets for data transformation
- census_sync - Data syncs between sources and destinations
All resources have corresponding data sources for read-only operations.
Resources & Documentation
- Terraform Registry - registry.terraform.io/providers/sutrolabs/census - Resource documentation, examples, and version history
- GitHub Repository - sutrolabs/terraform-provider-census - Source code and complete examples
- Developer Documentation - developers.getcensus.com - Full API reference
- CHANGELOG - View changelog - Version history and changes