Welcome to TerraReverse, an open-source tool designed to automatically reverse engineer Terraform code from existing infrastructure.
TerraReverse simplifies infrastructure management by translating your current deployments into reusable Terraform code. Whether you're migrating to Infrastructure as Code or documenting existing environments, TerraReverse helps bridge the gap between manually created infrastructure and code-defined resources.
- Multi-provider support: Extensible architecture for various infrastructure platforms
- Accurate translation: Convert existing resources into HCL (HashiCorp Configuration Language)
- Modular design: Each provider in its own module for easy maintenance
- CLI interface: Simple command-line tool for seamless integration
- Resource mapping: Automatically identify and map resources with their appropriate Terraform providers
- Auto-import state: Experimental feature for importing existing resource states (see CRASH_REPORT.md for known issues)
TerraReverse currently supports the following infrastructure provider:
| Provider | Resources | Documentation |
|---|---|---|
| Proxmox | Pools, Virtual Machines | providers/proxmox/README.md |
Additional providers can be added following our contribution guidelines.
Please review CRASH_REPORT.md for critical issues with the Terraform provider auto-import functionality.
TerraReverse is built using:
- Go: High-performance core functionality with modular provider architecture
- Cobra CLI: Professional command-line interface
- Provider APIs: Direct integration with infrastructure APIs
The modular architecture allows for easy extension and maintenance of provider-specific implementations.
- Go 1.21+
- Access to your infrastructure provider (API credentials)
- Terraform CLI (optional, for validating generated code)
# Install the latest version
go install github.com/your-username/terrareverse@latest
# Install a specific version
go install github.com/your-username/[email protected]# Clone the repository
git clone https://github.com/your-username/terrareverse.git
cd terrareverse
# Build the application
go build -o terrareverse .# Check installed version
terrareverse version# List available providers
./terrareverse provider
# Get help for a specific provider
./terrareverse provider proxmox
# Generate all Proxmox resources (using username/password)
./terrareverse --provider proxmox --resource all \
--url https://your-proxmox.com:8006 \
--username root@pam \
--password your-password \
--output ./terraform-output
# Generate only VMs for Proxmox (using API token - recommended)
./terrareverse --provider proxmox --resource vm \
--url https://your-proxmox.com:8006 \
--token-id your-token-id \
--secret your-token-secret \
--output ./terraform-output
# Generate with auto-import (experimental - see known issues)
./terrareverse --provider proxmox --resource all \
--url https://your-proxmox.com:8006 \
--token-id your-token-id \
--secret your-token-secret \
--output ./terraform-output \
--auto-import-state
# Generate multiple specific resource types
./terrareverse --provider proxmox --resource pool,vm \
--url https://your-proxmox.com:8006 \
--token-id your-token-id \
--secret your-token-secret \
--output ./terraform-outputEach provider has detailed documentation in its respective folder:
- Proxmox: providers/proxmox/README.md
For more detailed usage instructions, see the provider-specific documentation.
TerraReverse follows a modular provider-based architecture:
providers/
├── interface.go # Generic provider interface
└── {provider}/ # Provider-specific implementation
├── README.md # Provider documentation
├── client.go # API client
├── provider.go # Provider implementation
├── generator.go # Provider-specific generation logic
├── templates.go # Template processor
├── templates/ # Terraform template files
└── {resource}.go # Resource handlers
internal/
└── shared/
└── utils.go # Shared utilities (name sanitization, etc.)
We welcome contributions! Whether you want to:
- Add support for a new infrastructure provider
- Improve existing provider functionality
- Fix bugs or enhance documentation
- Add new features to the core system
Please see our CONTRIBUTING.md guide for detailed instructions on how to contribute to TerraReverse.
This project uses automated releases through GitHub Actions:
- Version Calculation: Uses GitVersion with semantic versioning
- Automated Testing: All PRs and pushes are automatically tested
- Release Creation: Pushes to
masterbranch trigger automatic releases - Package Registry: New versions are automatically published to pkg.go.dev
- Multi-platform Builds: Binaries are built for Linux, macOS, and Windows
If you need to create a manual release:
# Ensure you're on master and up to date
git checkout master
git pull origin master
# Push to trigger the release workflow
git push origin master
# The GitHub Action will:
# 1. Calculate version using GitVersion
# 2. Create and push a git tag
# 3. Build cross-platform binaries
# 4. Create a GitHub release
# 5. Trigger pkg.go.dev to index the new versionTerraReverse uses a modular provider-based architecture where each infrastructure provider is implemented as a separate module, making it easy to add support for new platforms.
This project is licensed under the MIT License - see the LICENSE file for details.
- HashiCorp for creating Terraform
- All contributors who have helped shape this project
Start your Infrastructure as Code journey today with TerraReverse!