Skip to main content

Managing Dagster+ with Terraform

Dagster+ feature

This feature is only available in Dagster+.

Early access preview

This feature is in preview phase and is available in Dagster+ in limited early access. Functionality and APIs may change as we continue development. To get early access to this feature, reach out to your Dagster account team. For more information, see the API lifecycle stages documentation.

Terraform by HashiCorp allows you to manage your infrastructure as code. Terraform providers act as an interface between Terraform and different platforms or services in your infrastructure. The Dagster+ Terraform provider lets you programmatically manage your Dagster+ organization's resources.

The provider is open source and available through the Terraform Registry. You can also clone it from the GitHub repository if you want to adapt it for a custom use case or contribute improvements.

When to use Terraform

Terraform is a good fit if your organization already uses infrastructure-as-code tooling or wants to:

  • Automate onboarding — provision deployments, invite users, and assign team permissions in a single workflow
  • Enforce consistency — ensure configuration is identical across environments (e.g. staging and prod have the same alert policies)
  • Audit changes — track who changed what and when through version control and Terraform state
  • Manage at scale — coordinate many deployments, users, or secrets without manual UI work

If you only occasionally adjust settings or are just getting started with Dagster+, the UI is usually simpler.

Getting started

Prerequisites

Configure the provider

terraform {
required_providers {
dagsterplus = {
source = "dagster-io/dagsterplus"
version = "~> 0.1"
}
}
}

provider "dagsterplus" {
organization = "my-org" # subdomain of your Dagster+ URL
}

Set your API token as an environment variable:

export DAGSTER_CLOUD_API_TOKEN="your-api-token"

Initialize Terraform and apply your configuration:

terraform init
terraform apply

Example

The following example creates a deployment, invites a user, and grants a team access. This is the kind of multi-step workflow that benefits most from automation:

resource "dagsterplus_user" "alice" {
email = "alice@example.com"
}

resource "dagsterplus_team" "data_engineering" {
name = "data-engineering"

deployment_grant {
deployment = "prod"
grant = "EDITOR"
}

member {
user_id = dagsterplus_user.alice.id
}
}