cinnamond3 / AWS2Terraform

Generating terrform code from exisiting aws resources

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AWS2Terraform

Gitpod Codacy Badge Java CI with Gradle master branch build

Status Not yet Language Java License

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.

Run

java -jar terraform-generator-shell-[version].jar

Usage of Commands

How to check Spring Shell CLI Builtin option.

https://docs.spring.io/spring-shell/docs/2.0.1.BUILD-SNAPSHOT/reference/htmlsingle/#built-in-commands

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

Common Options

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.

AWS Services supported

  1. EC2 Instances
  2. VPCs
  3. Subnets
  4. RouteTables
  5. Internet Gateways
  6. Egress Only Internet Gateways
  7. NAT Gateways
  8. ... It will be added gradually.

About

Generating terrform code from exisiting aws resources

License:Apache License 2.0


Languages

Language:Java 93.6%Language:HCL 5.3%Language:Batchfile 1.1%Language:Dockerfile 0.0%