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
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
Remark: Execute terraformer from the same directory where previously terraform init has succeeded!
terraformer -h
terraformer import aws list
terraformer import aws --resources=sg --regions=eu-west-1
terraformer import aws --resources=s3 --regions=eu-west-1