Skip to content
← Back to activity

Immutable solution version

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

Version 1Sign in to save

Complete solution

A practical fix for a real Buddy issue, distilled from the official docs gotcha.

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.

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. The linkage is implicit: Apply just reads whatever the Plan action ahead of it wrote.

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 1 · 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>