Skip to content
Reads from existing Cloud Providers (reverse Terraform) and generates your infrastructure as code on Terraform configuration
Branch: master
Clone or download
xescugc Updated: Changelog format (#43)
Updated: Changelog format
Latest commit a4d6c0c Jul 18, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.ci ci: add base context for pull request notifications Jul 16, 2019
aws Makefile: Change lint to not use 'errcheck' as it makes the code more… Jul 18, 2019
cache Added: File 'doc.go' to all the packages (#12) Jun 10, 2019
cmd log: Add logs to all of them Jul 18, 2019
errcode provider/import: Add validation to the 'Included' list before trying … Jun 20, 2019
filter log: Add logs to all of them Jul 18, 2019
log log: Add the log Singelton Jul 18, 2019
mock provider/provider: Add new function to the interface 'HasResourceType' Jun 20, 2019
provider Makefile: Change lint to not use 'errcheck' as it makes the code more… Jul 18, 2019
tag tag: Add tests for it Jun 14, 2019
util log: Add logs to all of them Jul 18, 2019
writer Makefile: Change lint to not use 'errcheck' as it makes the code more… Jul 18, 2019
.gitignore .gitignore: Remove the [Ll]og to be able to track the new folder Jul 18, 2019
CHANGELOG.md CHANGELOG: Update the format to one we use in other projects Jul 18, 2019
Dockerfile Dockerfile: Change it to build with the Version setted Jun 21, 2019
LICENSE doc: update Makefile and add documentation Jun 4, 2019
Makefile Makefile: Change lint to not use 'errcheck' as it makes the code more… Jul 18, 2019
README.md README: Update the Readme with the Changelog information Jul 18, 2019
go.mod go.mod: Update the dependencies Jul 18, 2019
go.sum go.mod: Update the dependencies Jul 18, 2019
main.go Rename from Terraforming to Terracognita Jun 3, 2019

README.md

TerraCognita (beta)

GoDoc Gitter chat

Imports your current Cloud infrastructure to an Infrastructure As Code Terraform configuration (HCL) or/and to a Terraform State.

To do so, it relies on raws a self-generated AWS reader. At this stage, raws supports various technologies.

At Cycloid, Infrastructure As Code is in the company DNA since the beginning. To help our new customers adopting this best practice, we decided to build Terracognita to convert an existing infrastructure on AWS into Terraform code in an automated way, relying on Terraform providers built by the community. We focused on AWS for a first release, but Azure, GCP, Alibaba, Vmware and Openstack will be the next to be integrated.

We decided to opensource this tool as we believe that it will help people to adopt IaC in an easy way. Cycloid provides this tool to let people import their infrastructure into Cycloid's pipelines, allow them to generate infrastructure diagram and manage all infra/application lifecycle from a single interface.

Installation

It uses Go Modules, so GO 1.11+ is required. If you wish to run it via docker then docker binary is required. While if you wish to run it locally; you will need to have the extra brz lib installed.

You have 2 options to get the package:

  • Clone the repository to $GOPATH/src/github.com/cycloidio/terracognita
  • go get -d github.com/cycloidio/terracognita

Then feel free to play with it :)

$> cd $GOPATH/src/github/cycloidio/terracognita
$> make install

Versions

Terracognita currently imports only AWS cloud provider as terraform resource/state. Please see the following versions as follow:

Terraform: 0.11.14 Providers:

  • AWS: 2.12.0

Usage

Using the terracognita --help you will know the basics.

$ make help
help: Makefile                   This help dialog
lint: $(GOLANGCI_LINT) $(GOLINT) Runs the linter
test:                            Runs the tests
ci: lint test                    Runs the linter and the tests
dbuild:                          Builds the docker image with same name as the binary
build:                           Bulids the binary
clean:                           Removes binary and/or docker image

asciicast

Docker

You can use directly the image built, or you can build your own. To build your Docker image just run:

$ make dbuild

And then depending on the image you want to use (cycloid/terracognita or your local build terracognita):

$ docker run cycloid/terracognita -h

Example:

$ export AWS_ACCESS_KEY_ID=XXXXXXXXXXXXXXXXXXXX
$ export AWS_SECRET_ACCESS_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
$ export AWS_DEFAULT_REGION=xx-yyyy-0
$ docker run \
		-v "${PWD}"/outputs:/app/outputs \
		cycloid/terracognita aws \
		--access-key="${AWS_ACCESS_KEY_ID}" \
		--secret-key="${AWS_SECRET_ACCESS_KEY}" \
		--region="${AWS_DEFAULT_REGION}" \
		--hcl app/outputs/resources.tf

Local

The local version can be used the same way as docker. You simply need to be build it locally.

To test

To speed up the testing, you can write a small provider.tffile within the same folder you imported your resources & tfstate:

terraform {
 backend "local" {
   path = "./$TFSTATE_PATH"
 }
}

provider "aws" {
 access_key = "${var.access_key}"
 secret_key = "${var.secret_key}"
 region     = "${var.region}"
 version    = "2.12.0"
}

variable "access_key" {}
variable "secret_key" {}
variable "region" {}

Then run the terraform init & plan commands:

$ terraform init
$ terraform plan -var access_key=$AWS_ACCESS_KEY_ID -var secret_key=$AWS_SECRET_ACCESS_KEY -var region=$AWS_DEFAULT_REGION

License

Please see the MIT LICENSE file.

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

About Cycloid

Cycloid is a European fully-remote company, building a product to simplify, accelerate and optimize your DevOps and Cloud adoption.

We built Cycloid, your DevOps platform to encourage Developers and Ops to work together with the respect of best practices. We want to provide a tool that eliminates the silo effect in a company and allows to share the same level of informations within all professions.

Cycloid supports you to factorize your application in a reproducable way, to deploy a new environment in one click. This is what we call a stack.

A stack is composed of 3 pillars:

  1. the pipeline (Concourse)
  2. infrastructure layer (Terraform)
  3. applicative layer (Ansible)

Thanks to the flexible pipeline, all the steps and technologies are configurable.

To make it easier to create a stack, we build an Infrastructure designer named StackCraft that allows you to drag & drop Terraform ressources and generate your Terraform files for you.

Terracognita is a brick that will help us to import an existing infrastructure into a stack to easily adopt Cycloid product.

The product comes also with an Open Source service catalog (all our public stacks are on Github) to deploy applications seamlessly. To manage the whole lifecycle of an application, it also integrates the diagram of the infrastructure and the application, a cost management control to centralize Cloud billing, the monitoring, logs and events centralized with Prometheus, Grafana, ELK.

Don't hesitate to contact us, we'll be happy to meet you !

You can’t perform that action at this time.