Terraformer (terraform)
Introduction
Terraformer is a CLI tool that generates tf/json and tfstate files based on existing infraestructure (reverse Terraform). It supports AWS, among many other providers.
https://github.com/GoogleCloudPlatform/terraformer
Install
Follow instructions on the Terraformer page, eg:
export PROVIDER=aws
curl -LO https://github.com/GoogleCloudPlatform/terraformer/releases/download/$(curl -s https://api.github.com/repos/GoogleCloudPlatform/terraformer/releases/latest | grep tag_name | cut -d '"' -f 4)/terraformer-${PROVIDER}-linux-amd64
chmod +x terraformer-${PROVIDER}-linux-amd64
sudo mv terraformer-${PROVIDER}-linux-amd64 /usr/local/bin/terraformer
Validate:
$ terraformer -v
version v0.8.17
Samples
Remark: Execute terraformer from the same directory where previously terraform init has succeeded!
Help
terraformer -h
List supported resources for aws provider
terraformer import aws list
SGs (all) - Generate .tf w/ all security groups
terraformer import aws --resources=sg --regions=eu-west-1
S3s (all) - Generate .tf w/ all S3 buckets
terraformer import aws --resources=s3 --regions=eu-west-1