terraformer

(★ 14,560)

CLI tool to generate terraform files from existing infrastructure (reverse Terraform). Infrastructure to Code

File Explorer

  • .gitignore
  • .golangci.json
  • AUTHORS
  • CODE_OF_CONDUCT.md
  • CONTRIBUTING.md
  • go.mod
  • go.sum
  • LICENSE
  • main.go
  • README.md
  • SECURITY.md

# Installation Guide

go
Prerequisites

Setup Steps

git clone https://github.com/GoogleCloudPlatform/terraformer.git

Clone the repository locally.

go mod download

Download Go module dependencies.

go build -o terraformer main.go

Build the terraformer binary.

./terraformer import aws --resources=vpc,subnet --regions=eu-west-1

Import existing infrastructure to Terraform code.

Key Commands

go build -o terraformer main.go

Compile the Terraformer source code into an executable binary.

terraformer import aws --resources=vpc,subnet --regions=eu-west-1

Convert existing infrastructure resources of the specified cloud provider into HCL and tfstate.

terraformer plan google --resources=networks,firewall --projects=my-project

Generate a plan file for the resources to be imported.

terraform state replace-provider -auto-approve "registry.terraform.io/-/aws" "hashicorp/aws"

Migrate the provider registry source in the Terraform state file.

Read-only permissions and authentication credentials are required to access cloud resources.

# Use via CDN

jsDelivr

jsDelivr serves any public GitHub repository as a CDN with zero setup. Pick a version and a file to get a ready-to-paste link and snippet.

Release Timeline

Command Glossary

Commands referenced in this DOCs, explained below.

🔍

aws

View Details ▼

The official CLI tool for Amazon Web Services.
Some subcommands such as `s3` have their own usage documentation.

aws configure wizard

Configure the AWS Command-line:

aws configure sso

Configure the AWS Command-line using SSO:

aws sts get-caller-identity

Get the caller identity (used to troubleshoot permissions):

🔍

brew install

View Details ▼

Install a Homebrew formula or cask.

brew install {{formula|cask}}

Install a formula/cask:

brew install {{[-s|--build-from-source]}} {{formula}}

Build and install a formula from source (dependencies will still be installed from bottles):

brew install {{[-n|--dry-run]}} {{formula|cask}}

Download the manifest, print what would be installed but don't actually install anything:

🔍

git clone

View Details ▼

Clone an existing repository.

git clone {{remote_repository_location}} {{path/to/directory}}

Clone an existing repository into a new directory (the default directory is the repository name):

git clone --recursive {{remote_repository_location}}

Clone an existing repository and its submodules:

git clone {{[-n|--no-checkout]}} {{remote_repository_location}}

Clone only the `.git` directory of an existing repository:

🔍

go build

View Details ▼

Compile Go sources.

go build {{path/to/main.go}}

Compile a 'package main' file (output will be the filename without extension):

go build -o {{path/to/binary}} {{path/to/source.go}}

Compile, specifying the output filename:

go build -o {{path/to/binary}} {{path/to/package}}

Compile a package:

🔍

go mod

View Details ▼

Module maintenance.

go mod init {{module_name}}

Initialize new module in current directory:

go mod download

Download modules to local cache:

go mod tidy

Add missing and remove unused modules:

🔍

go run

View Details ▼

Compile and run Go code without saving a binary.

go run {{path/to/file.go}}

Run a Go file:

go run {{path/to/package}}

Run a main Go package:

🔍

terraform init

View Details ▼

Initialize a new or existing Terraform working directory.

terraform init

Initialize the current working directory:

terraform init -upgrade

Initialize and upgrade modules and providers to the latest allowed versions:

terraform init -reconfigure

Initialize and reconfigure the backend, ignoring any saved configuration:

🔍

terraform

View Details ▼

Create and deploy infrastructure as code to cloud providers.

terraform init

Initialize a new or existing Terraform configuration:

terraform validate

Verify that the configuration files are syntactically valid:

terraform fmt

Format configuration according to Terraform language style conventions:

🔍

choco install

View Details ▼

Install one or more packages with Chocolatey.

choco install {{package1 package2 ...}}

Install one or more packages:

choco install {{path\to\packages_file.config}}

Install packages from a custom configuration file:

choco install {{path\to\file}}

Install a specific `.nuspec` or `.nupkg` file:

# Project Badges

// repository documentation