A CLI tool for refactoring Terraform configurations, with built-in support for upgrading AWS provider to v4.
tfedit is a refactoring tool for Terraform configurations that automates large-scale updates, particularly focusing on upgrading to AWS provider v4. It transforms deprecated resource arguments into new separate resources and generates state migration files, helping teams manage breaking changes efficiently.
Terraform users and DevOps engineers managing AWS infrastructure who need to upgrade their configurations to AWS provider v4, especially those with many S3 bucket resources requiring refactoring.
It provides a scalable, automated way to refactor Terraform configurations while preserving comments and integrating with existing CLI workflows, reducing manual effort and error risk during major provider upgrades.
A refactoring tool for Terraform
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Automates the tedious splitting of deprecated aws_s3_bucket arguments into separate resources (e.g., acl into aws_s3_bucket_acl), directly addressing the breaking changes in AWS provider v4 as shown in the example.
Updates Terraform configurations while retaining existing comments, which is critical for maintaining documentation and readability during large-scale refactors, as highlighted in the features.
Reads from stdin and writes to stdout, enabling easy piping with other commands and integration into scripts or CI/CD pipelines, demonstrated by the usage examples with terraform plan output.
Generates import migration files for tfmigrate from Terraform JSON plan files, automating state management during upgrades and reducing manual import command errors.
Includes a Docker-based sandbox with LocalStack for testing refactors without real AWS credentials, allowing risk-free experimentation as described in the example workflow.
Primarily focuses on AWS provider v4 upgrades, specifically S3 bucket refactoring; it explicitly states it's not intended as a general upgrade tool for all providers.
Has known limitations where non-literal values (e.g., variables in grant permissions) or state-dependent arguments (e.g., grant owner) require manual AWS API calls or edits, as admitted in the README.
Some meta-arguments like dynamic blocks are not yet implemented for the awsv4upgrade filter, and only a subset of AWS provider changes are covered, limiting its applicability.
Relies on external tools like tfupdate for provider version changes and tfmigrate for state migrations, adding setup complexity and potential integration hurdles.