plan-terraform

Runs and reviews an Azure-backed Terraform plan for infrastructure pull requests in a detached worktree.

801|25|Updated Jan 10, 2026
One-click install
npx skills add https://github.com/learntocloud/learn-to-cloud-app --skill plan-terraform
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: plan-terraform
Source: https://github.com/learntocloud/learn-to-cloud-app/tree/main/.github/skills/plan-terraform
Command: npx skills add https://github.com/learntocloud/learn-to-cloud-app --skill plan-terraform

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Reviewing infrastructure pull requests requires running Terraform plan against real Azure state, but doing so in your working directory risks polluting your worktree, touching remote state, or accidentally applying changes. This Skill performs a safe, read-only plan review in an isolated worktree.

Core Features & Use Cases

  • Isolated Plan Execution: Creates a detached git worktree at the PR's exact head SHA so your primary worktree and remote state are never modified.
  • Backend Parity with CI: Mirrors the backend key and TF_VAR inputs from the repository's deploy workflow so the plan matches what CI would produce.
  • Guardrailed Review: Blocks on destroy/replacement actions, identity or authentication changes, and state-access failures, and never applies, unlocks, imports, or merges.
  • Use Case: A maintainer receives a PR that changes Terraform modules under infra/. Instead of checking out the branch locally, they ask the assistant to plan the PR, and receive a full report of every resource action compared against the diff.

Quick Start

Ask the assistant to run a Terraform plan review for the open infrastructure pull request and report every planned resource action.

Frequently Asked Questions about plan-terraform

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run a Terraform plan for a pull request without checking out the branch?

Create a detached git worktree at the PR's head SHA and run terraform init and plan inside it. This Skill automates that flow, placing the worktree under the session's files directory and removing it afterward.

How to review Terraform changes in a PR safely?

Run terraform plan in an isolated worktree using the same backend key and TF_VAR inputs as your deploy workflow, then compare every planned action against the PR diff. Never apply, unlock, import, or modify state during review.

Does terraform plan modify remote state or infrastructure?

No, terraform plan is read-only against real infrastructure and only refreshes state in memory. This Skill additionally forbids saving plan files, applying, unlocking, or importing, so remote state is never changed.

Why does terraform plan fail with state access or authorization errors?

Failures occur when Azure CLI is not authenticated, the active subscription does not match the expected AZURE_SUBSCRIPTION_ID, or the identity lacks read access to the backend storage. Verify Azure CLI login and subscription before running init.

When should a Terraform plan review block a pull request?

Block when the plan shows resource destroys or replacements, identity or authentication changes, state-access failures, or any action not explained by the PR diff. A 'No changes' result is expected for provider-only updates.