Skip to content

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.

engine:
name: terraform
tf_version: latest

There are different valid keys depending on the engine name.

KeyTypeDescription
nameStringThe name of the tool to use for executing Terraform operations. Can be terraform, tofu, terragrunt, cdktf, or custom. Default is terraform.
KeyTypeDescription
nameStringterraform or tofu depending on which specific implementation to use.
override_tf_cmdStringBy default, either terraform or tofu is used to run operations. This configuration overrides the program to call.
versionStringWhich version of the terraform or tofu to use.
outputsObjectSee outputs below.
KeyTypeDescription
nameStringterragrunt
override_tf_cmdStringOverride the name of the Terragrunt program to run.
tf_cmdStringWhich underlying Terraform-compatible program to use. By default it is terraform.
tf_versionStringThe version of the underlying Terraform-compatible tool to use (either Terraform or Tofu).
versionStringThe version of Terragrunt to use.
outputsObjectSee outputs below.
KeyTypeDescription
nameStringcdktf
override_tf_cmdStringOverride the name of the CDKTF program to run.
tf_cmdStringWhich underlying Terraform-compatible program to use. By default it is terraform.
tf_versionStringThe version of the underlying Terraform-compatible tool to use (either Terraform or Tofu).
outputsObjectSee outputs below.

All custom engine steps are optionally and will simply be skipped if they are not specified.

KeyTypeDescription
initArrayThe command to run during the init step.
planArrayThe command to run during the plan step. The TERRATEAM_PLAN_FILE environment variable is available to write a plan file that will be accessible in the apply step. This plan file is up to the engine to define and use as it needs.
diffArrayThe command to produce a human-readable diff of the plan output.
applyArrayThe command to run during the apply step.
outputsArrayThe command to return output values as a JSON string.

By default, Terrateam collects the outputs of all apply runs an stores them. The outputs configuration controls this behaviour.

KeyTypeDescription
collectBooleantrue to collect outputs, false to disable. Default is true.
engine:
name: terraform
version: '1.0.0'
engine:
name: tofu
version: '1.9.0'

Using Terragrunt with a Specific Terraform Version

Section titled “Using Terragrunt with a Specific Terraform Version”
engine:
name: terragrunt
tf_version: '1.11.1'
engine:
name: terragrunt
tf_cmd: tofu

Using CDKTF with the Latest Terraform Version

Section titled “Using CDKTF with the Latest Terraform Version”
engine:
name: cdktf
engine:
name: pulumi
engine:
name: custom
init: ['echo', 'init']
plan: ['my-custom-plan']
diff: ['printf', '+ added foo\n- removed bar\n~ updated baz\n']
apply: ['my-custom-apply']
outputs: ['echo', '{"foo": "bar"}']

This configuration defines a fully custom engine using shell commands for each step. All steps are optional - you can define only what you need.

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 or cdktf, you can specify the version of Terraform or OpenTofu CLI to use with the tf_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. All steps are optional - you may specify only the steps relevant to your use case. The TERRATEAM_PLAN_FILE environment variable allows passing data from the plan step to the apply step. The outputs step, if defined, must return valid JSON.