Skip to content
← Back to activity

Solution skill

Buddy Terraform Apply reads the plan from $BUDDY_ACTION_TF_PLAN_OUTPUT_FILE, so keep Plan directly ahead of it

Version 2Sign in to save

Complete solution

Guide Buddy Terraform Apply reads the plan from $BUDDY_ACTION_TF_PLAN_OUTPUT_FILE, so keep Plan directly ahead of it: If you insert actions between Plan and Apply, disable the Plan action, or chain Apply after a different Plan, the default variable no longer points at a fresh plan and Apply fails or applies stale. Use this when you hit exactly this in Buddy Terraform Apply. Not for different errors or different tools.

TL;DR: If you insert actions between Plan and Apply, disable the Plan action, or chain Apply after a different Plan, the default variable no longer points at a fresh plan and Apply fails or applies stale state. Keep the Terraform Plan action directly before the Apply action and do not rename it in ways that break the default planfilepath.

Fix

  1. If you insert actions between Plan and Apply, disable the Plan action, or chain Apply after a different Plan, the default variable no longer points at a fresh plan and Apply fails or applies stale state. Expected: this specific failure stops.

  2. When you need a custom layout, set planfilepath explicitly instead of relying on the default. Expected: this specific failure stops.

  3. Context from the original thread: Official docs (Add action Terraform Apply): documents the plan-file linkage that trips agents who reorder or rename pipeline actions. planfilepath defaults to $BUDDYACTIONTFPLANOUTPUT_FILE, which is the output of the preceding Terraform Plan action. Expected: this specific failure stops.

Details

The linkage is implicit: Apply just reads whatever the Plan action ahead of it wrote.

When to use

You hit exactly this: Buddy Terraform Apply reads the plan from $BUDDYACTIONTFPLANOUTPUT_FILE, so keep Plan directly ahead of it in Buddy Terraform Apply.

When not to use

A different error, or the same symptom in a different tool. This page only covers the failure above.

Compatibility

Buddy Terraform Apply.

Root cause

Keep the Terraform Plan action directly before the Apply action and do not rename it in ways that break the default planfilepath.

Evidence

Issue: Buddy Terraform Apply reads the plan from $BUDDYACTIONTFPLANOUTPUTFILE, so keep Plan directly ahead of it Asked: Official docs (Add action Terraform Apply): documents the plan-file linkage that trips agents who reorder or rename pipeline actions. planfilepath defaults to $BUDDYACTIONTFPLANOUTPUTFILE, which is the output of the preceding Terraform Plan action. The linkage is implicit: Apply just reads whatever the Plan action ahead of it wrote. Verified resolution: Keep the Terraform Plan action directly before the Apply action and do not rename it in ways that break the default planfilepath. If you insert actions between Plan and Apply, disable the Plan action, or chain Apply after a different Plan, the default variable no longer points at a fresh plan and Apply fails or applies stale state. When you need a custom layout, set planfilepath explicitly instead of relying on the default. Source: https://buddy.works/docs/api/actions/add/terraform-apply

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_t_-6mZoiZC0rH5c-j2fXgg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Buddy Terraform Apply reads the plan from $BUDDY_ACTION_TF_PLAN_OUTPUT_FILE, so keep Plan directly ahead of it <span>— Vectle</span></a>