Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Terraform
  3. tfautomv

tfautomv

Apache-2.0Gov0.7.0

Automatically generates Terraform moved blocks and state move commands for safe infrastructure code refactoring.

Visit WebsiteGitHubGitHub
891 stars25 forks0 contributors

What is tfautomv?

tfautomv is a command-line tool that automates the generation of Terraform `moved` blocks and state move commands. It solves the problem of Terraform losing track of resource state during code refactoring (like renaming resources or moving them between modules), which would otherwise cause plans to delete and recreate infrastructure unnecessarily.

Target Audience

Terraform, OpenTofu, or Terragrunt users who need to refactor their infrastructure code safely, particularly DevOps engineers, platform teams, and infrastructure developers managing complex Terraform codebases.

Value Proposition

Developers choose tfautomv because it eliminates the manual, error-prone process of writing `moved` blocks or state move commands. It automatically detects moves by analyzing plan output, supports advanced use cases like multi-directory moves, and integrates seamlessly into CI/CD workflows, making refactoring faster and safer.

Overview

Generate Terraform moved blocks automatically for painless refactoring

Use Cases

Best For

  • Renaming Terraform resources without causing recreation plans
  • Moving resources between modules or directories in a codebase
  • Refactoring Terraform code that uses `for_each` or module restructuring
  • Automating state moves in CI/CD pipelines for infrastructure changes
  • Working with large, multi-module Terraform projects where manual move tracking is difficult
  • Ensuring safe refactoring separate from infrastructure configuration changes

Not Ideal For

  • Projects that mix resource renaming with configuration changes (e.g., updating tags or security groups in the same commit)
  • Environments with unreliable Terraform plan output due to provider bugs or state drift
  • Teams needing fully automated move application without manual command execution or block integration
  • Scenarios involving complex provider transformations not covered by built-in ignore rules (e.g., custom attribute modifications)

Pros & Cons

Pros

Automated Move Detection

Analyzes Terraform plan output to identify creation/deletion pairs from refactoring, eliminating the manual error-prone process of writing moved blocks or state commands.

Flexible Output Formats

Generates either Terraform moved blocks (for v1.1+) or terraform state mv commands for cross-directory moves, as detailed in the core features, catering to different workflow needs.

Multi-Directory Analysis

Can analyze multiple Terraform modules in a single run to find moves across directories, a feature Terraform doesn't natively support, making it ideal for large codebases.

CI/CD Integration Ready

Supports pre-generated plan files with the --preplanned flag, allowing seamless integration into enterprise pipelines without re-running expensive terraform plans.

Cons

Pure Refactoring Limitation

As emphasized in the best practices, it's ineffective for mixed changes where refactoring is combined with infrastructure updates, requiring a strict separation of structural and configuration changes.

Complex Ignore Rules Risk

The --ignore flag, while useful for provider quirks, can lead to incorrect resource matches if misused, as warned in the documentation, adding complexity and potential for errors.

No Cross-Directory Moved Blocks

For moves across different directories, it only outputs state mv commands instead of moved blocks, which may require additional manual steps and isn't as elegant for some Terraform workflows.

Frequently Asked Questions

Quick Stats

Stars891
Forks25
Contributors0
Open Issues6
Last commit4 days ago
CreatedSince 2022

Tags

#hacktoberfest#devops#opentofu#terragrunt#terraform#infrastructure-as-code#block#golang#refactoring#automation#state-management#move

Built With

G
Go

Links & Resources

Website

Included in

Terraform6.3k
Auto-fetched 6 hours ago

Related Projects

terraformerterraformer

CLI tool to generate terraform files from existing infrastructure (reverse Terraform). Infrastructure to Code

Stars14,531
Forks1,824
Last commit1 month ago
InfracostInfracost

Cloud cost estimates for Terraform in pull requests💰📉 Shift FinOps Left!

Stars12,278
Forks667
Last commit1 day ago
TerragruntTerragrunt

Terragrunt is a flexible orchestration tool that allows Infrastructure as Code written in OpenTofu/Terraform to scale.

Stars9,552
Forks1,178
Last commit1 day ago
atlantisatlantis

Terraform Pull Request Automation

Stars9,049
Forks1,264
Last commit10 hours ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub