Terraform
You can manage resources with the Terraform provider for Prefect. 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:- Bucket Sensors for AWS, Azure, and GCP
- ECS Worker on AWS Fargate
- ACI Worker on Azure Container Instances
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.
uv for managing Python dependencies.
This example will show you how to set up a Pulumi project using the uv toolchain.
Creating a new Pulumi project
Creating a new Pulumi project
To create a new Python Pulumi project using the To finish setting up your new Pulumi project, navigate to the project directory and install the dependencies:
uv toolchain, run the following command:Don’t name your project any of the following, otherwise you will have package name conflicts:
pulumiprefectpulumi-prefect
An explanation of the flags used:
- The
--yesflag skips the interactive prompts and accepts the defaults. You can omit this flag, or edit the generatedPulumi.yamlfile later to customize your project settings. - The
--generate-onlyjust creates a new Pulumi project. It does not create a stack, save config, or install dependencies. - The
--nameand--descriptionflags set the name and description of your Pulumi project. - The
--runtime-options toolchain=uvand--runtime-options virtualenv=.venvflags configures the Pulumi project to use theuvtoolchain instead of the default,pip.
Using an existing Pulumi project
Using an existing Pulumi project
If you already have a Pulumi project, you can switch to the This configures your Pulumi project to use the
uv toolchain by updating
your pulumi.yaml file runtime settings as shown below:Pulumi.yaml
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: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.pulumi up to create the resources in your Prefect workspace.
Helm
You can manage resources with the Prefect Helm charts. Each Helm chart subdirectory contains usage documentation. There are two main charts:- The
prefect-serverchart is used to a deploy a Prefect server. This is an alternative to using Prefect Cloud. - The
prefect-workerchart is used to deploy a Prefect worker.
prefect-prometheus-exporter chart that is used to deploy a Prometheus exporter,
exposing Prefect metrics for monitoring and alerting.