YAML for Terraform Plan

View as Markdown

Run terraform/tofu init and plan in a Docker container, then render a structured plan diff (add/update/destroy/replace).

YAML parameters for Terraform Plan

PARAMETERS
toolrequiredstring enum
The Terraform tool to run: OPENTOFU, TERRAFORM (FOSS, up to 1.5.7) or CUSTOM.
Allowed enum:
OPENTOFU,
TERRAFORM,
CUSTOM
typerequiredstring

Value: TERRAFORM_PLAN

actionrequiredstring
Unique identifier for the action within the pipeline.
versionstring
Tool version, e.g. 1.9.0 or latest. Required unless tool is CUSTOM.
custom_binary_pathstring
Path to the binary inside the Docker image, e.g. /usr/local/bin/tofu. Required when tool is CUSTOM.
docker_image_namestring
Custom Docker image to run in. Required when tool is CUSTOM.
docker_image_tagstring
Tag of the custom Docker image.
image_locationstring enum
The location of the image used by the action.
Allowed enum:
PUBLIC_REGISTRY,
PRIVATE_REGISTRY,
ACTION,
ARTIFACT_REGISTRY
docker_registrystring enum
The type of registry from which the image is retrieved.
Allowed enum:
NONE,
DOCKER_HUB,
AMAZON_ECR,
GOOGLE_GCR,
GOOGLE_ARTIFACT_REGISTRY,
OTHER,
GIT_HUB_CONTAINER_REGISTRY,
ARTIFACT_REGISTRY,
DIGITAL_OCEAN_CONTAINER_REGISTRY
registrystring
The URL of the Docker registry. Required when docker_registry is OTHER.
loginstring
Username for Docker registry authentication. Used with password when docker_registry is OTHER.
passwordstring
Password for Docker registry authentication. Used with login when docker_registry is OTHER.
regionstring
The region of the Docker registry (for Amazon ECR).
integrationstring
Docker registry integration used to pull the custom image. It refers to an integration in the workspace by its identifier, not by its display name.
working_directorystring
Path relative to the repository root. Defaults to ..
additional_argsstring
Extra CLI arguments appended to the command, as a single space-separated string. Example: -var-file=prod.tfvars -parallelism=20.
tf_workspacestring
Terraform workspace to run in, exported to the tool as TF_WORKSPACE. Set the same value in the Plan and Apply actions, otherwise Apply runs against a different state. Defaults to default, or to TF_WORKSPACE set as a pipeline variable.
backendTerraformRunBackendYaml
State backend configuration: type (CUSTOM, AMAZON, GOOGLE, ARTIFACT), integration, region, artifact and artifact_version. Defaults to CUSTOM, which means the backend is declared in the Terraform code. The backend integration is separate from the action integration pulling the custom runner image.
trigger_timestring enum
Specifies when the action should be executed. ON_SUCCESS actions run after every successful run, also one ended by an EARLY_EXIT action.
Allowed enum:
ON_EVERY_EXECUTION,
ON_SUCCESS,
ON_FAILURE,
ON_BACK_TO_SUCCESS,
ON_WARNING,
ON_WAIT_FOR_APPROVE,
ON_TERMINATE
loopstring[]
Names of the variables to loop over (IMAGES, not $IMAGES and not a value). The action runs once for each item of the value, and once for each combination of items when several variables are listed. The variable value is split into items by new lines, or by commas when it has no new lines (a single-line JSON object or key=value pairs stays one item). An item that is a JSON object or key=value pairs also sets one variable per key, named <VARIABLE>_<key>; an item that starts with EXTRACT: sets them as plain <key>.
run_only_on_first_failureboolean
When true, the action runs only on the first failure instead of on each failure. Used only when trigger_time is ON_FAILURE.
disabledboolean
When set to true the action is disabled. By default it is set to false.
timeoutinteger
The timeout in seconds. It cannot exceed the action time limit of the workspace plan; a higher value is rejected.
ignore_errorsboolean
If set to true the execution will proceed, mark action as a warning and jump to the next action. Doesn't apply to deployment actions.
retry_intervalinteger
Delay time between auto retries in seconds.
retry_countinteger
Number of retries if the action fails.

Constraints: ≤ 10

run_nextstring enum
Defines whether the action should run in parallel with the next one.
Allowed enum:
WAIT_ON_SUCCESS,
IN_SOFT_PARALLEL,
IN_HARD_PARALLEL
trigger_conditionsTriggerConditionYaml[]
The list of trigger conditions to meet so that the action can be triggered.
variablesVariableYaml[]
The list of variables you can use in the action.

Outputs for Terraform Plan

OUTPUT VARIABLES
BUDDY_ACTION_TF_PLAN_OUTPUT_FILE
Path to the main result file of this action, relative to the pipeline filesystem root.

Example: .buddy/output/terraform/plan_12_a1b2c3d.tfplan

BUDDY_ACTION_TF_PLAN_ADD_COUNT
Number of resources to create. Resources that are replaced are counted only in the replace counter.

Example: 3

BUDDY_ACTION_TF_PLAN_CHANGE_COUNT
Number of resources to update in place. Resources that are replaced are counted only in the replace counter.

Example: 1

BUDDY_ACTION_TF_PLAN_DESTROY_COUNT
Number of resources to destroy. Resources that are replaced are counted only in the replace counter.

Example: 2

BUDDY_ACTION_TF_PLAN_REPLACE_COUNT
Number of resources to replace, counted once regardless of the order of destroy and create.

Example: 1

BUDDY_ACTION_TF_PLAN_TOTAL_COUNT
Number of resources with any change. Resources left untouched are not counted.

Example: 7

BUDDY_ACTION_TF_PLAN_SUMMARY
Summary as reported by the tool, where a replacement counts both as an addition and as a destruction, so it can differ from the counters above.

Example: 4 to add, 1 to change, 3 to destroy

BUDDY_ACTION_TF_PLAN_WORKSPACE
Workspace the action ran in.

Example: default

BUDDY_ACTION_TF_PLAN_TOOL_VERSION
Version of Terraform or OpenTofu that produced the plan.

Example: 1.5.7

BUDDY_ACTION_TF_PLAN_DESTROY_RESOURCES
Addresses of the resources to destroy, one per line. Resources that are replaced are not listed here.

Example: aws_instance.web aws_s3_bucket.logs

OUTPUT FILES
.buddy/output/terraform/plan_$BUDDY_RUN_ID_$BUDDY_ACTION_RUN_HASH.tfplan
Binary plan file, passed to a later apply action.
.buddy/output/terraform/plan_$BUDDY_RUN_ID_$BUDDY_ACTION_RUN_HASH.json
Plan rendered as JSON.

Last modified on Nov 19, 2026

YAML examples for Terraform Plan

Terraform Plan

yaml
- action: "Terraform Plan"
  type: "TERRAFORM_PLAN"
  tool: "OPENTOFU"
  version: "1.9.0"

Terraform Plan with arguments

yaml
- action: "Terraform Plan"
  type: "TERRAFORM_PLAN"
  tool: "OPENTOFU"
  version: "1.9.0"
  working_directory: "./infrastructure/prod"
  tf_workspace: "production"
  additional_args: "-var-file=prod.tfvars -parallelism=20"

Terraform Plan with custom binary

yaml
- action: "Terraform Plan"
  type: "TERRAFORM_PLAN"
  tool: "CUSTOM"
  custom_binary_path: "/opt/terraform/bin/terraform"
  docker_image_name: "mycompany/terraform-runner"
  docker_image_tag: "1.9.5"
  working_directory: "./infrastructure/prod"

Terraform Plan with custom image from a private registry

yaml
- action: "Terraform Plan"
  type: "TERRAFORM_PLAN"
  tool: "CUSTOM"
  custom_binary_path: "/usr/local/bin/tofu"
  docker_image_name: "mycompany/terraform-runner"
  docker_image_tag: "1.9.5"
  image_location: "PRIVATE_REGISTRY"
  docker_registry: "OTHER"
  registry: "my.registry.com"
  login: "buddyworks"
  password: "${top_secret_password}"
  working_directory: "./infrastructure/prod"

Terraform Plan with state in a Buddy artifact

yaml
- action: "Terraform Plan"
  type: "TERRAFORM_PLAN"
  tool: "OPENTOFU"
  version: "1.9.0"
  working_directory: "./infrastructure/prod"
  backend:
    type: "ARTIFACT"
    artifact: "terraform-state"
    artifact_version: "1.0.0"

Terraform Plan with state in Amazon S3

yaml
- action: "Terraform Plan"
  type: "TERRAFORM_PLAN"
  tool: "OPENTOFU"
  version: "1.9.0"
  working_directory: "./infrastructure/prod"
  backend:
    type: "AMAZON"
    integration: "amazon-web-services"
    region: "us-east-1"

Terraform Plan with custom image from Amazon ECR

yaml
- action: "Terraform Plan"
  type: "TERRAFORM_PLAN"
  tool: "CUSTOM"
  custom_binary_path: "/usr/local/bin/terraform"
  docker_image_name: "terraform-runner"
  docker_image_tag: "1.9.5"
  image_location: "PRIVATE_REGISTRY"
  docker_registry: "AMAZON_ECR"
  region: "us-east-1"
  integration: "my_integration"
  working_directory: "./infrastructure/prod"