Terraformer
Terraformer is a powerful command-line interface (CLI) tool designed for engineers and cloud administrators. It helps in generating Terraform files such as .tf
, .json
, and tfstate
from existing cloud infrastructure, effectively providing a reverse Terraform functionality. Created by Waze SRE, this tool is not officially affiliated with Google, despite its development under the GoogleCloudPlatform organization.
Capabilities
Terraformer's primary capabilities include:
- Generating Terraform configuration and state files from existing infrastructure across a variety of cloud services.
- Supporting the upload of the remote state to Google Cloud Storage (GCS) buckets.
- Enabling connections between resources using
terraform_remote_state
. - Allowing users to deploy custom folder tree patterns for file storage.
- Facilitating imports by resource name and type.
- Compatibility with Terraform 0.13 while maintaining backward compatibility for version 0.11 with specific releases.
Utilizing Terraform providers, the tool is designed to easily accommodate new resources with minimal adjustments needed by simply upgrading the associated Terraform providers.
Supported Providers
Terraformer supports a wide range of cloud services and providers, categorized into major cloud providers like Google Cloud, AWS, Azure, along with others like AliCloud and IBM Cloud. It also supports various infrastructure software like Kubernetes and RabbitMQ, network providers like Cloudflare, and several other specialized services. This versatility makes Terraformer a highly adaptable tool suitable for diverse cloud environments and infrastructure management tasks.
Key Features
Permissions and Resources: The tool operates with read-only permissions to list service resources effectively. Users can specify resources to be imported using parameters such as --resources
and can exclude certain services using the --excludes
flag.
Filtering and Planning: Terraformer offers robust filtering options, allowing users to import only selected resources based on identifiers or attributes. Through filtering, it helps streamline the importing process by focusing on relevant resources. Additionally, the plan
command allows for pre-import customization by generating a plan file of resources set for import, making changes simpler before the actual import process.
Resource Structure and Output: The tool organizes resources neatly by default, but users can adjust this structure using parameters like --compact
to consolidate resources or --path-pattern
to customize directory outputs.
Installation
Terraformer can be easily installed through various methods:
- Package Manager: Available on Homebrew, MacPorts, and Chocolatey for straightforward installation.
- Direct Download: Users can download the appropriate releases directly from GitHub for Linux, macOS, or Windows.
- Source Build: Advanced users can clone the Terraformer repository and build it from source using Go tools, which offers flexibility for customizing providers.
Using Terraformer
The typical workflow with Terraformer involves:
- Running the import command to fetch specific resources from a provider.
- Utilizing flags and options for specifying output formats, paths, regions, and filters.
- Reviewing the generated files to ensure accurate representation of existing infrastructure.
The overall process is enhanced by Terraformer's reliance on Terraform's providers, ensuring consistent updates and support across various environments.
Contributing and Development
Terraformer encourages contributions from developers willing to improve its functionality or add support for new providers. The contributing process is detailed in their documentation, emphasizing collaboration and openness to community enhancements.
Summary
Terraformer effectively serves as a bridge between existing cloud infrastructure and Terraform, automating the generation of configuration and state files. Its broad support for various providers and cloud environments, coupled with its flexible installation and usage options, makes it an essential tool for cloud infrastructure management and automation. Whether for cloud migration, backup, or assessment tasks, Terraformer provides a robust solution catered to both cloud newcomers and experienced infrastructure engineers.