New to Kestra?
Use blueprints to kickstart your first workflows.
Run tofu init, plan, and apply as one audited Kestra execution with a saved plan, captured artifacts, and Slack reporting instead of laptop applies.
Infrastructure applied from a laptop leaves no trace of what was planned, what changed, or who was told. This blueprint moves the whole OpenTofu lifecycle into one Kestra execution through io.kestra.plugin.opentofu.cli.OpenTofuCLI. The configuration arrives through inputFiles, the task saves a plan and applies exactly that saved plan, outputFiles uploads the rendered artifact and the state file to Kestra internal storage, and Slack receives the result with the execution ID. Every apply becomes a versioned run with full logs.
plan_and_apply (io.kestra.plugin.opentofu.cli.OpenTofuCLI) receives main.tf through inputFiles. The demo config uses the local_file provider to render an app-config.json, so it runs anywhere with no cloud credentials.commands runs tofu init, then tofu plan -out=plan.tfplan, then tofu apply plan.tfplan. Applying the saved plan file means the apply executes exactly what the plan computed, never a fresh evaluation.outputFiles uploads app-config.json and terraform.tfstate to Kestra internal storage, so downstream tasks and humans can inspect exactly what this run produced.notify posts the outcome to Slack, and the errors block posts a distinct alert when init, plan, or apply fails.main.tf and adding provider credentials.OpenTofu computes and applies changes, but it does not schedule itself, keep an execution history, retry container-level failures, or notify anyone. Kestra wraps the unchanged tofu commands with all of that: the flow YAML lives in Git, the execution view shows every command's logs, secrets stay in Kestra's secret backend, and outputs flow into notifications and downstream tasks.
env from {{ secret('...') }}.SLACK_WEBHOOK_URL: Slack incoming webhook URL.SLACK_WEBHOOK_URL secret to your Kestra namespace.plan_and_apply task outputs to download app-config.json and terraform.tfstate.main.tf with your real configuration and add provider credentials through env.tofu plan -detailed-exitcode on a schedule to catch drift, as shown in the OpenTofu drift detection blueprint.namespaceFiles instead of inline inputFiles.