{"id":13448960,"url":"https://github.com/cycloidio/terracognita","last_synced_at":"2025-04-13T14:08:26.627Z","repository":{"id":37612239,"uuid":"169991093","full_name":"cycloidio/terracognita","owner":"cycloidio","description":"Reads from existing public and private cloud providers (reverse Terraform) and generates your infrastructure as code on Terraform configuration","archived":false,"fork":false,"pushed_at":"2024-05-08T08:40:16.000Z","size":158507,"stargazers_count":2265,"open_issues_count":91,"forks_count":170,"subscribers_count":37,"default_branch":"master","last_synced_at":"2025-04-13T14:08:20.413Z","etag":null,"topics":["aws","azure","azure-devops","cloud","cycloid","devops","devops-tools","gcp","go","golang","google-cloud-platform","hybrid-cloud","iac","iac-terraform","infrastructure-as-code","reverse-engineering","terraform","tfstate","vmware"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cycloidio.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-02-10T15:11:44.000Z","updated_at":"2025-04-13T09:01:38.000Z","dependencies_parsed_at":"2024-06-18T19:53:33.987Z","dependency_job_id":"45761a34-449d-4e1e-a453-dae92d094b09","html_url":"https://github.com/cycloidio/terracognita","commit_stats":{"total_commits":564,"total_committers":22,"mean_commits":"25.636363636363637","dds":0.5195035460992907,"last_synced_commit":"a8683bc2b8d1d6f1a159137c7dc5e5b44288b376"},"previous_names":["cycloidio/terraforming"],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cycloidio%2Fterracognita","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cycloidio%2Fterracognita/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cycloidio%2Fterracognita/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cycloidio%2Fterracognita/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cycloidio","download_url":"https://codeload.github.com/cycloidio/terracognita/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248724631,"owners_count":21151561,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","azure","azure-devops","cloud","cycloid","devops","devops-tools","gcp","go","golang","google-cloud-platform","hybrid-cloud","iac","iac-terraform","infrastructure-as-code","reverse-engineering","terraform","tfstate","vmware"],"created_at":"2024-07-31T06:00:26.362Z","updated_at":"2025-04-13T14:08:26.558Z","avatar_url":"https://github.com/cycloidio.png","language":"Go","funding_links":[],"categories":["Go","azure","Infrastructure as code","Tools","aws","Repositories"],"sub_categories":["Infrastructure as code generation","Community providers"],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"docs/terracognita-icon_color.png\" width=\"150\"\u003e\n\u003c/p\u003e\n\n# TerraCognita\n\n[![GoDoc](https://godoc.org/github.com/cycloidio/terracognita?status.svg)](https://godoc.org/github.com/cycloidio/terracognita)\n[![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/cycloidio/terracognita)\n[![AUR package](https://repology.org/badge/version-for-repo/aur/terracognita.svg)](https://repology.org/project/terracognita/versions)\n[![Homebrew](https://img.shields.io/badge/dynamic/json.svg?url=https://formulae.brew.sh/api/formula/terracognita.json\u0026query=$.versions.stable\u0026label=homebrew)](https://formulae.brew.sh/formula/terracognita)\n\nImports your current Cloud infrastructure to an Infrastructure As Code [Terraform](https://www.terraform.io/) configuration (HCL) or/and to a Terraform State.\n\nAt [Cycloid](https://www.cycloid.io/), 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 Cloud Infrastructure into Terraform code in an automated way, relying on Terraform providers built by the community. We focused on AWS, GCP, Azure and Vmware.\n\nWe decided to Open Source 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](https://www.cycloid.io/devops-framework), allow them to generate infrastructure diagram and manage all infra/application life cycle from a single interface.\n\nIf you are interested in contributing to Terracognita or simply curious about what's next, take a look at the public [roadmap](https://github.com/cycloidio/terracognita/issues/118). For a high level overview, check out the [What is Terracognita?](https://blog.cycloid.io/what-is-terracognita) blogpost or watch this [video](https://www.youtube.com/watch?v=PtJgf7AWBVA).\n\n## Cloud providers\n\nTerracognita currently imports AWS, GCP, AzureRM and VMware vSphere cloud providers as Terraform (v1.1.9) resource/state.\nPlease see the following versions as follow:\n\nProviders:\n * AWS: v4.9.0\n * AzureRM: v3.20.0\n * Google: v4.9.0\n * vSphere: v2.2.0\n\n## Installation\n\n### Binary\n\nVisit the [releases](https://github.com/cycloidio/terracognita/releases) page to select your system, architecture and version you need. To pull the latest release:\n\n```shell\ncurl -L https://github.com/cycloidio/terracognita/releases/latest/download/terracognita-linux-amd64.tar.gz -o terracognita-linux-amd64.tar.gz\ntar -xf terracognita-linux-amd64.tar.gz\nchmod u+x terracognita-linux-amd64\nsudo mv terracognita-linux-amd64 /usr/local/bin/terracognita\n```\n\n### Development\n\nYou can build and install with the latest sources, you will enjoy the new features and bug fixes. It uses Go Modules, so GO 1.17+ is required.\n\n```shell\ngit clone https://github.com/cycloidio/terracognita\ncd terracognita\nmake install\n```\n\n### Arch Linux\n\nThere are two entries in the AUR: [terracognita-git](https://aur.archlinux.org/packages/terracognita-git/) (targets the latest git commit) and [terracognita](https://aur.archlinux.org/packages/terracognita) (targets the latest stable release).\n\n```shell\nyay -Ss terracognita\n  aur/terracognita 1:0.3.0-1 (+0 0.00%)\n      Reads from existing Cloud Providers (reverse Terraform) and generates your infrastructure as code on Terraform configuration\n  aur/terracognita-git 1:v0.3.0.r27.gdfc5a99-1 (+0 0.00%)\n      Reads from existing Cloud Providers (reverse Terraform) and generates your infrastructure as code on Terraform configuration\n```\n\n### Install via brew\n\nIf you're macOS user and using [Homebrew](https://brew.sh/), you can install via brew command:\n\n```sh\nbrew install terracognita\n```\n\n## Usage\n\nThe main usage of Terracognita is:\n\n```bash\nterracognita [TERRAFORM_PROVIDER] [--flags]\n```\n\nYou replace the `TERRAFORM_PROVIDER` with the Provider you want to use (for example `aws`) and then add the other required flags.\nEach Provider has different flags and different required flags.\n\nThe more general ones are the `--hcl` or `--module` and `--tfstate` which indicates the output file for the HCL (or module)\nand the TFState that will be generated.\n\nYou can also `--include` or `--exclude` multiple resources by using the Terraform name it has like `aws_instance`.\n\nFor more options you can always use `terracognita --help` and `terracognita [TERRAFORM_PROVIDER] --help` for the\nspecific documentation of the Provider.\n\nWe also have `make help` that provide some helpers on using the actual codebase of Terracognita\n\n[![asciicast](https://asciinema.org/a/330055.svg)](https://asciinema.org/a/330055)\n\n### Modules\n\nTerracognita can generate Terraform Modules directly when importing. To enable this feature you'll need to use the `--module {module/path/name}` and then on that specific path is where the module will be generated. The path has to be directory or a none existent path (it'll be created), the content of the path will be deleted (after user confirmation) so we can have a clean import.\n\nThe output structure will look like (having `--module test`) this where each file aggregates the resources from the same \"category\":\n\n```\ntest/\n├── module-test\n│   ├── autoscaling.tf\n│   ├── cloud_front.tf\n│   ├── cloud_watch.tf\n│   ├── ec2.tf\n│   ├── elastic_load_balancing_v2_alb_nlb.tf\n│   ├── iam.tf\n│   ├── rds.tf\n│   ├── route53_resolver.tf\n│   ├── route53.tf\n│   ├── s3.tf\n│   ├── ses.tf\n│   └── variables.tf\n└── module.tf\n```\n\nBy default all the attributes will be changed for variables, those variables will then be on the `module-{name}/variables.tf` and exposed on the `module.tf` like so:\n\n```hcl\nmodule \"test\" {\n  # aws_instance_front_instance_type = \"t2.small\"\n  [...]\n  source = \"module-test\"\n}\n```\n\nIf you want to change this behavior, as for big infrastructures this will create a lot of variables, you can use the `--module-variables path/to/file` and the file will have the list of attributes that you want to actually be used as variables, it can be in JSON or YAML:\n\n```json\n{\n  \"aws_instance\": [\n    \"instance_type\",\n    \"cpu_threads_per_core\",\n    \"cpu_core_count\"\n  ]\n}\n```\n\n```yaml\naws_instance:\n  - instance_type\n  - cpu_threads_per_core\n  - cpu_core_count\n```\n\n### Docker\n\nYou can use directly [the image built](https://hub.docker.com/r/cycloid/terracognita), or you can build your own.\nTo build your Docker image just run:\n\n```bash\nmake dbuild\n```\n\nAnd then depending on the image you want to use (`cycloid/terracognita` or your local build `terracognita`):\n\n```bash\ndocker run cycloid/terracognita -h\n```\n\nExample:\n\n```bash\nexport AWS_ACCESS_KEY_ID=XXXXXXXXXXXXXXXXXXXX\nexport AWS_SECRET_ACCESS_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\nexport AWS_DEFAULT_REGION=xx-yyyy-0\ndocker run \\\n\t\t-v \"${PWD}\"/outputs:/app/outputs \\\n\t\tcycloid/terracognita aws \\\n\t\t--hcl app/outputs/resources.tf\n```\n\n### Local\n\nThe local version can be used the same way as docker. You simply need to be build it locally.\n\n### To test\n\nOn the same folder you imported you can run the terraform init \u0026 plan commands:\n\n```bash\nterraform init\nterraform plan -var access_key=$AWS_ACCESS_KEY_ID -var secret_key=$AWS_SECRET_ACCESS_KEY -var region=$AWS_DEFAULT_REGION\n```\n\n## License\n\nPlease see the [MIT LICENSE](https://github.com/cycloidio/terracognita/blob/master/LICENSE) file.\n\n## Changelog\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n## Meet Cycloid\n\n[Cycloid](https://www.cycloid.io/) is a sustainable platform engineering to allow anyone to interact with tools, automation and cloud without having to become an expert and in respect of the best practices. Inside the self-service portal, you find some modules around Governance, deployment, operations, Finops and GreenOps. InfraImport inside Cycloid is the visual representation of Terracognita. \n\nAs of now, we have three open-source tools:\n\n* [TerraCognita](https://github.com/cycloidio/terracognita): Read from your existing cloud providers and generate IaC in Terraform \n* [InfraMap](https://github.com/cycloidio/inframap): Reads .tfstate or HCL to generate a graph specific for each provider\n* [TerraCost](https://github.com/cycloidio/terracost): Cloud cost estimation for Terraform in the CLI\n\n...and the functionality of each is also embedded in our platform, which you can find out more about [here](https://www.cycloid.io).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcycloidio%2Fterracognita","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcycloidio%2Fterracognita","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcycloidio%2Fterracognita/lists"}