Provision Kestra Flows and Namespaces with the Terraform Provider
For the complete documentation index, see llms.txt. For a full content snapshot, see llms-full.txt. Append.mdto anykestra.io/docs/*URL for plain Markdown.
Use Terraform to provision, manage, and automate changes to Kestra resources.
Manage Kestra resources with Terraform
The official Kestra Terraform Provider lets you manage Kestra resources as code. Define flows, namespaces, and other resources declaratively, and Terraform creates, updates, and deletes them for you.
For flows managed through CI/CD or infrastructure-as-code, add the system.readOnly label set to "true" so the UI editor is disabled and production configurations stay immutable. This is especially recommended for critical production flows:
labels: system.readOnly: trueMultitenancy
The Kestra Terraform provider supports multitenancy, allowing you to manage resources across multiple tenants from a single configuration.
When configuring the provider, include the tenant_id parameter to specify the tenant you want to target.
provider "kestra" { tenant_id = "kestra-tech" url = "http://your-kestra-url:8080"}Example configuration
Start with a Terraform configuration file, typically named provider.tf or main.tf, that sets up the Kestra provider.
provider.tf
provider "kestra" { # Required: Kestra server URL url = "http://localhost:8080"
# Required for multitenant environments tenant_id = "kestra-tech"
# Optional: basic authentication username = "admin@example.com" password = var.kestra_password
# Optional: API token (Enterprise Edition) api_token = var.kestra_api_token
# Optional: JWT authentication (Enterprise Edition) jwt = "<your-jwt>"}version.tf
Define the provider source and version to ensure compatibility.
terraform { required_providers { kestra = { source = "kestra-io/kestra" version = "~> 2.0" } }}flows.tf
Create a flow resource from a YAML file that contains your flow definition. The flow’s ID and namespace come from the file:
resource "kestra_flow" "flow_example" { content = file("kestra/flows/my-flow.yml")}Next steps
- Review the full Kestra Terraform Provider documentation.
- Use Terraform commands like
terraform validate,plan, andapplyto manage your Kestra infrastructure. - Integrate Terraform into your CI/CD pipeline for automated deployments.
Was this page helpful?