Skip to main content
You can manage many Prefect resources with tools like Terraform and Helm. These options are a viable alternative to Prefect’s CLI and UI.

Terraform

This documentation represents all Prefect resources that are supported by Terraform. This Terraform provider is maintained by the Prefect team, and is undergoing active development to reach parity with the Prefect API. The Prefect team welcomes contributions, feature requests, and bug reports via our issue tracker.

Terraform Modules

Prefect maintains several Terraform modules to help you get started with common infrastructure patterns:

Pulumi

Prefect does not maintain an official Pulumi package. However, you can use Pulumi’s terraform-provider to automatically generate a Pulumi SDK from the Prefect Terraform provider. For details, refer to the Pulumi documentation on Terraform providers.
You will need to be using Pulumi version >= 3.147.0.
In this example, we will use Pulumi to deploy a flow to Prefect. Prefect recommends using the uv for managing Python dependencies. This example will show you how to set up a Pulumi project using the uv toolchain.
To create a new Python Pulumi project using the uv toolchain, run the following command:
Don’t name your project any of the following, otherwise you will have package name conflicts:
  • pulumi
  • prefect
  • pulumi-prefect
An explanation of the flags used:
  • The --yes flag skips the interactive prompts and accepts the defaults. You can omit this flag, or edit the generated Pulumi.yaml file later to customize your project settings.
  • The --generate-only just creates a new Pulumi project. It does not create a stack, save config, or install dependencies.
  • The --name and --description flags set the name and description of your Pulumi project.
  • The --runtime-options toolchain=uv and --runtime-options virtualenv=.venv flags configures the Pulumi project to use the uv toolchain instead of the default, pip.
To finish setting up your new Pulumi project, navigate to the project directory and install the dependencies:
If you already have a Pulumi project, you can switch to the uv toolchain by updating your pulumi.yaml file runtime settings as shown below:
Pulumi.yaml
This configures your Pulumi project to use the uv toolchain and the virtual environment located at .venv.Run the following to update Pulumi to use the uv toolchain:

Managing Resources with Pulumi

To manage resources with Pulumi, add the Prefect Terraform provider to your Pulumi project:
Optionally, you can specify a specific version, e.g.:
This will auto-generate a pulumi-prefect Python package. The code will be placed in the sdks/prefect directory inside the Pulumi project.

Example: Deploying a Flow with Pulumi

This simple example shows you how to deploy a flow to Prefect.
Now you can run pulumi up to create the resources in your Prefect workspace.

Helm

Each Helm chart subdirectory contains usage documentation. There are two main charts:
  • The prefect-server chart is used to a deploy a Prefect server. This is an alternative to using Prefect Cloud.
  • The prefect-worker chart is used to deploy a Prefect worker.
Finally, there is a prefect-prometheus-exporter chart that is used to deploy a Prometheus exporter, exposing Prefect metrics for monitoring and alerting.