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 .md to any kestra.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.

Multitenancy

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

Was this page helpful?