This project is intended to extract resources created in AWS as Terraform resources.
I implemented the CLI using Spring Shell project and JCommander library.
The goal of the current project is an extract program for Terraform resources, and will be developed in the future towards generating tfvar and tfstates according to standardized Terraform code.
java -jar terraform-generator-shell-[version].jar
How to check Spring Shell CLI Builtin option.
export:>help
AVAILABLE COMMANDS
Built-In Commands
clear: Clear the shell screen.
exit, quit: Exit the shell.
help: Display help about available commands.
history: Display or save the history of previously run commands
script: Read and execute commands from a file.
stacktrace: Display the full stacktrace of the last error.
Ec2Commands
ec2instances: Export terraform resources of ec2 instances.
Vpc Commands
internet-gateways: Export terraform resources of InternetGateways
nat-gateways: Export terraform resources of NatGateways
vpcs: Export terraform resources of vpcs
How to check command-specific options.
export:><command> help
Usage: <command> [options]
Options:
-D, --delete-output-directory
delete output directory before generate.
Default: true
--dir
output terraform file directory path
Default: ./output
-E, --explicit
explicit output files by terraform types. - default: true
Default: true
* -P, --profile
aws profile name by ~/.aws/credentials and config ex) default
--provider-file-name
provider.tf will be generate with name <provider file name>.tf
Default: provider.tf
* -R, --region
aws region id ex) us-east-1
--resource-file-name
terraform resources file name will be generate with name <resource file name>.tf
Default: main.tf
-S, --silence
no stdout.
Default: true
help
display usage informations.
- EC2 Instances
- VPCs
- Subnets
- RouteTables
- Internet Gateways
- Egress Only Internet Gateways
- NAT Gateways
- ... It will be added gradually.