Choosing and Configuring an Engine
Terrateam supports multiple execution engines, giving you the flexibility to choose the right tool for your workflow. Whether you are using standard Terraform, OpenTofu, Terragrunt, CDKTF, or even a fully custom engine, Terrateam makes it possible to configure plan and apply behavior that suits your needs.
You can define the engine globally or override it per workflow by using the engine key in your .terrateam/config.yml file.
Built In Engine Types
Section titled “Built In Engine Types”Terraform (default)
Section titled “Terraform (default)”engine: name: terraformOpenTofu
Section titled “OpenTofu”engine: name: tofu version: '1.9.0'Terragrunt
Section titled “Terragrunt”engine: name: terragrunt tf_version: '1.5.7'engine: name: cdktf tf_cmd: tofuPulumi
Section titled “Pulumi”engine: name: pulumiStategraph
Section titled “Stategraph”engine: name: stategraph tf_cmd: tofuSee the Stategraph integration guide for the required secrets and stategraph.json.
Custom Engine
Section titled “Custom Engine”Use a custom engine when you need to perform tasks outside of standard Terraform or OpenTofu workflows, or when integrating with other infrastructure tools (e.g., custom wrappers, or legacy systems).
Example: Custom Engine
Section titled “Example: Custom Engine”Below is an example configuration for a custom engine. Each key corresponds to a step in the Terrateam workflow. All steps are optional - define only what you need.
engine: name: custom # The command to run during the init step (optional) init: ['echo', 'init'] # The command to run during the plan step (optional) plan: ['my-custom-plan'] # The command to produce a human-readable diff of the plan output (optional) diff: ['printf', '+ added foo\n- removed bar\n~ updated bar\n'] # The command to print the plan's resource counts as JSON (optional) resource_summary: ['echo', '{"created": 1, "updated": 0, "replaced": 0, "deleted": 0}'] # The command to run during the apply step (optional) apply: ['my-custom-apply'] # The command to run for terrateam apply-autoapprove, which has no stored plan (optional) unsafe_apply: ['my-custom-apply', '--no-plan'] # The command to return output values as a JSON string (optional) outputs: ['echo', '{"foo": "bar"}']Highlights:
- All steps (
init,plan,diff,resource_summary,apply,unsafe_apply,outputs) are optional - Define only the steps that make sense for your use case
$TERRATEAM_PLAN_FILEenvironment variable is available to pass data from plan to apply- Use this pattern to integrate with any tool or custom process
How It Works
Section titled “How It Works”Each key corresponds to a step in the Terrateam workflow:
initThe command to run during the init step. Optional.planThe command to run during the plan step. Optional.diffThe command to produce a human-readable diff of the plan output. Optional.resource_summaryThe command to print the plan’s resource counts as a JSON object with the integer keyscreated,updated,replacedanddeleted. It runs after a plan that reports changes, and its counts appear in the status check description and the summary comment. Optional.applyThe command to run during the apply step. Optional.unsafe_applyThe command to run forterrateam apply-autoapprove, which applies without a previously stored plan. Optional.outputsThe command to return output values as a JSON string. Optional.
All steps are optional - you can define any combination of steps that makes sense for your use case.
Per Workflow Engines
Section titled “Per Workflow Engines”If you have different workflows (for example, dev and prod), you can override the engine configuration per workflow. Just nest the engine block inside a workflow definition.
workflows: - tag_query: "development" engine: name: tofu - tag_query: "production" engine: name: terraformBest Practices
Section titled “Best Practices”- Use per-workflow engine configurations to maximize flexibility.
- Use
versionon theterraformandtofuengines, andtf_cmdandtf_versionon theterragrunt,cdktf, andstategraphengines, to control which Terraform compatible CLI is invoked. - For custom engines, test locally with the same environment variables Terrateam uses (especially
TERRATEAM_PLAN_FILE).