Lightlines
By hashicorp

refactor-module

hashicorp

Turn monolithic Terraform into reusable modules.

infrastructure refactoring

What it does

Refactors existing Terraform configurations into reusable modules with tests and a state-migration path.

When to use it

Use when transforming a monolithic Terraform configuration into reusable, maintainable modules.

How to use it

Give it an existing Terraform project, a module name, and a state-preservation choice; it refactors the configuration in the project.

What you provide

  • the source directory
  • the new module name
  • whether to preserve state
  • An existing project

Uses


Access · 2

This skill

real infrastructure

Write

Creates real test infrastructure

current Terraform state

Write

Moves Terraform state addresses

What you need · 2

The Terraform CLI must be available to inspect current state for migration planning.

The workflow directs the agent to use terraform-test for the testing step.


About this skill

Visibility
Public
Repository
hashicorp/agent-skills
Created
Oct 8, 2026
Updated
Oct 8, 2026
Files
1