engine
The engine
configuration allows you to specify which tool should be used for executing plan and apply operations. Terrateam supports multiple tools, including Terraform, OpenTofu, Terragrunt, Pulumi, CDKTF, and custom engines. This configuration can be defined globally or overridden per workflow by including it under the workflows
key.
Default Configuration
engine: name: terraform tf_version: latest tf_cmd: terraform
Keys
Key | Type | Description |
---|---|---|
name | String | The name of the tool to use for executing Terraform operations. Can be terraform , tofu , terragrunt , cdktf , or custom . Default is terraform . |
version | String | The version of the tool to use. Only applies to terraform , tofu , and terragrunt . This value is overridden by any version information specified in the Terraform or OpenTofu code. Default is latest . |
tf_version | String | The version of the Terraform or OpenTofu CLI to use when engine.name is set to terragrunt or cdktf . Default is latest . |
tf_cmd | String | The command to use for terragrunt or cdktf executions. Can be terraform or tofu . Default is terraform . |
init | Array | (Custom engine only) The command to run during the init step. Optional. |
plan | Array | (Custom engine only) The command to run during the plan step. Must write to the path specified by the TERRATEAM_PLAN_FILE environment variable. Required. |
diff | Array | (Custom engine only) The command to produce a human-readable diff of the plan output. Optional. |
apply | Array | (Custom engine only) The command to run during the apply step. Optional. |
outputs | Array | (Custom engine only) The command to return output values as a JSON string. Optional. |
Examples
Using Terraform
engine: name: terraform version: 1.0.0
Using OpenTofu
engine: name: tofu version: 1.9.0
Using Terragrunt with a Specific Terraform Version
engine: name: terragrunt tf_version: 1.11.1
Using Terragrunt with OpenTofu
engine: name: terragrunt tf_cmd: tofu
Using CDKTF with the Latest Terraform Version
engine: name: cdktf
Using Pulumi
engine: name: pulumi
Using a Custom Engine
engine: name: custom init: ['echo', 'init'] plan: ['touch', '$TERRATEAM_PLAN_FILE'] diff: ['printf', '+ added foo\n- removed bar\n~ updated baz\n'] apply: ['cat', 'foo.txt'] outputs: ['echo', '{"foo": "bar"}']
This configuration defines a fully custom engine using shell commands for each step.
Considerations
When configuring engine
, keep the following in mind:
- The
terraform
engine is the default and most commonly used option. It directly uses the Terraform CLI for executing Terraform operations. - The
tofu
engine uses OpenTofu, an open-source reimplementation of the Terraform CLI. It provides additional features and enhancements over the standard Terraform CLI. - The
terragrunt
engine uses Terragrunt, a thin wrapper for Terraform that provides extra tools for keeping your configurations DRY, working with multiple Terraform modules, and managing remote state. - The
cdktf
engine uses CDKTF (Cloud Development Kit for Terraform), which allows you to define your infrastructure using familiar programming languages like TypeScript, Python, Go, and Java. - When using
terragrunt
orcdktf
, you can specify the version of Terraform or OpenTofu CLI to use with thetf_version
option. This allows you to control the underlying Terraform version independently of the Terragrunt or CDKTF version. - The
custom
engine allows full control over each step in the pipeline. You may specify only the steps relevant to your use case. Forplan
, you must write output toTERRATEAM_PLAN_FILE
. Theoutputs
step must return valid JSON.