TopGit theo dõi GoogleCloudPlatform/terraformer trên GitHub trong nhóm Developer Tools, đã đạt 14.6k sao. CLI tool to generate terraform files from existing infrastructure (reverse Terraform). Infrastructure to Code
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
This project is no longer maintained and is deprecated.
As of March 16, 2026, this repository has been archived. It is now read-only, and no further updates, security patches, or support will be provided.
A CLI tool that generates tf/json and tfstate files based on existing infrastructure
(reverse Terraform).
Disclaimer: This is not an official Google product
Created by: Waze SRE
Table of Contents
Demo GCP
Capabilities
Installation
Supported Providers
Major Cloud
Google Cloud
AWS
Azure
AliCloud
IBM Cloud
Cloud
DigitalOcean
Equinix Metal
Fastly
Heroku
LaunchDarkly
Linode
NS1
OpenStack
TencentCloud
Vultr
Yandex Cloud
Ionos Cloud
Infrastructure Software
Kubernetes
OctopusDeploy
RabbitMQ
Network
Cloudflare (broken, see #1761)
Myrasec
PAN-OS
VCS
Azure DevOps
GitHub
Gitlab
Monitoring & System Management
Datadog
New Relic
Mackerel
PagerDuty
Opsgenie
Honeycomb.io
Opal
Community
Keycloak
Logz.io
Commercetools
Mikrotik
Xen Orchestra
GmailFilter
Grafana
Vault
Identity
Okta
Auth0
AzureAD
Contributing
Developing
Infrastructure
Stargazers over time
Demo GCP
Capabilities
Generate tf/json + tfstate files from existing infrastructure for all
supported objects by resource.
Remote state can be uploaded to a GCS bucket.
Connect between resources with terraform_remote_state (local and bucket).
Save tf/json files using a custom folder tree pattern.
Import by resource name and type.
Support terraform 0.13 (for terraform 0.11 use v0.7.9).
Terraformer uses Terraform providers and is designed to easily support newly added resources.
To upgrade resources with new fields, all you need to do is upgrade the relevant Terraform providers.
Import current state to Terraform configuration from a provider
Usage:
import [provider] [flags]
import [provider] [command]
Available Commands:
list List supported resources for a provider
Flags:
-b, --bucket string gs://terraform-state
-c, --connect (default true)
-С, --compact (default false)
-x, --excludes strings firewalls,networks
-f, --filter strings compute_firewall=id1:id2:id4
-h, --help help for google
-O, --output string output format hcl or json (default "hcl")
-o, --path-output string (default "generated")
-p, --path-pattern string {output}/{provider}/ (default "{output}/{provider}/{service}/")
--projects strings
-z, --regions strings europe-west1, (default [global])
-r, --resources strings firewall,networks or * for all services
-s, --state string local or bucket (default "local")
-v, --verbose verbose mode
-n, --retry-number number of retries to perform if refresh fails
-m, --retry-sleep-ms time in ms to sleep between retries
Use " import [provider] [command] --help" for more information about a command.
Permissions
The tool requires read-only permissions to list service resources.
Resources
You can use --resources parameter to tell resources from what service you want to import.
To import resources from all services, use --resources="*" . If you want to exclude certain services, you can combine the parameter with --excludes to exclude resources from services you don't want to import e.g. --resources="*" --excludes="iam".
Filtering
Filters are a way to choose which resources terraformer imports. It's possible to filter resources by its identifiers or attributes. Multiple filtering values are separated by :. If an identifier contains this symbol, value should be wrapped in ' e.g. --filter=resource=id1:'project:dataset_id'. Identifier based filters will be executed before Terraformer will try to refresh remote state.
Use Type when you need to filter only one of several types of resources. Multiple filters can be combined when importing different resource types. An example would be importing all AWS security groups from a specific AWS VPC:
Notice how the Name is different for sg than it is for vpc.
Migration state version
For terraform >= 0.13, you can use replace-provider to migrate state from previous versions.
Example usage:
terraform state replace-provider -auto-approve "registry.terraform.io/-/aws" "hashicorp/aws"
Resource ID
Filtering is based on Terraform resource ID patterns. To find valid ID patterns for your resource, check the import part of the Terraform documentation.
Will only import the s3 resources that have tag Abc.def.
Planning
The plan command generates a planfile that contains all the resources set to be imported. By modifying the planfile before running the import command, you can rename or filter the resources you'd like to import.
The rest of subcommands and parameters are identical to the import command.
$ terraformer plan google --resources=networks,firewall --projects=my-project --regions=europe-west1-d
(snip)
Saving planfile to generated/google/my-project/terraformer/plan.json
After reviewing/customizing the planfile, begin the import by running import plan.
$ terraformer import plan generated/google/my-project/terraformer/plan.json
Resource structure
Terraformer by default separates each resource into a file, which is put into a given service directory.
The default path for resource files is {output}/{provider}/{service}/{resource}.tf and can vary for each provider.
It's possible to adjust the generated structure by:
Using --compact parameter to group resource files within a single service into one resources.tf file
Adjusting the --path-pattern parameter and passing e.g. --path-pattern {output}/{provider}/ to generate resources for all services in one directory
It's possible to combine --compact--path-pattern parameters together.
Installation
Both Terraformer and a Terraform provider plugin need to be installed.
Terraformer
From a package manager
Homebrew users can use brew install terraformer.
MacPorts users can use sudo port install terraformer.
Chocolatey users can use choco install terraformer.
From releases
This installs all providers, set PROVIDER to one of google, aws or kubernetes if you only need one.
Download exe file for required provider from here - https://github.com/GoogleCloudPlatform/terraformer/releases
Add the exe file path to path variable
From source
Run git clone <terraformer repo> && cd terraformer/
Run go mod download
Run go build -v for all providers OR build with one provider
go run build/main.go {google,aws,azure,kubernetes,etc}
Terraform Providers
Create a working folder and initialize the Terraform provider plugin. This folder will be where you run Terraformer commands.
Run terraform init against a versions.tf file to install the plugins required for your platform. For example, if you need plugins for the google provider, versions.tf should contain:
Or, copy your Terraform provider's plugin(s) from the list below to folder ~/.terraform.d/plugins/, as appropriate.
Links to download Terraform provider plugins:
Major Cloud
Google Cloud provider >2.11.0 - here
AWS provider >2.25.0 - here
Azure provider >1.35.0 - here
Alicloud provider >1.57.1 - here
Cloud
DigitalOcean provider >1.9.1 - here
Heroku provider >2.2.1 - here
LaunchDarkly provider >=2.1.1 - here
Linode provider >1.8.0 - here
OpenStack provider >1.21.1 - here
TencentCloud provider >1.50.0 - here
Vultr provider >1.0.5 - here
Yandex provider >0.42.0 - here
Ionoscloud provider >6.3.3 - here
Infrastructure Software
Kubernetes provider >=1.9.0 - here
RabbitMQ provider >=1.1.0 - here
Network
Myrasec provider >1.44 - here
Cloudflare provider >1.16 - here
Fastly provider >0.16.1 - here
NS1 provider >1.8.3 - here
PAN-OS provider >= 1.8.3 - here
VCS
GitHub provider >=2.2.1 - here
Monitoring & System Management
Datadog provider >2.1.0 - here
New Relic provider >2.0.0 - here
Mackerel provider > 0.0.6 - here
Pagerduty >=1.9 - here
Opsgenie >= 0.6.0 here
Honeycomb.io >= 0.10.0 - here
Opal >= 0.0.2 - here
Community
Keycloak provider >=1.19.0 - here
Logz.io provider >=1.1.1 - here
Commercetools provider >= 0.21.0 - here
Mikrotik provider >= 0.2.2 - here
Xen Orchestra provider >= 0.18.0 - here
GmailFilter provider >= 1.0.1 - here
Vault provider - here
Auth0 provider - here
AzureAD provider - here
Information on provider plugins:
https://www.terraform.io/docs/configuration/providers.html
High-Level steps to add new provider
Initialize provider details in cmd/root.go and create a provider initialization file in the terraformer/cmd folder
Create a folder under terraformer/providers/ for your provider
Create two files under this folder
<provide_name>_provider.go
<provide_name>_service.go
Initialize all provider's supported services in <provide_name>_provider.go file
Create script for each supported service in same folder
Contributing
If you have improvements or fixes, we would love to have your contributions.
Please read CONTRIBUTING.md for more information on the process we would like
contributors to follow.
Developing
Terraformer was built so you can easily add new providers of any kind.
Process for generating tf/json + tfstate files:
Call GCP/AWS/other api and get list of resources.
Iterate over resources and take only the ID (we don't need mapping fields!).
Call to provider for readonly fields.
Call to infrastructure and take tf + tfstate.
Infrastructure
Call to provider using the refresh method and get all data.
Convert refresh data to go struct.
Generate HCL file - tf/json files.
Generate tfstate files.
All mapping of resource is made by providers and Terraform. Upgrades are needed only
for providers.
GCP compute resources
For GCP compute resources, use generated code from
providers/gcp/gcp_compute_code_generator.
To regenerate code:
go run providers/gcp/gcp_compute_code_generator/*.go
Similar projects
terraforming
Terraformer Benefits
Simpler to add new providers and resources - already supports AWS, GCP, GitHub, Kubernetes, and Openstack. Terraforming supports only AWS.
Better support for HCL + tfstate, including updates for Terraform 0.12.
If a provider adds new attributes to a resource, there is no need change Terraformer code - just update the Terraform provider on your laptop.
Automatically supports connections between resources in HCL files.
Comparison
Terraforming gets all attributes from cloud APIs and creates HCL and tfstate files with templating. Each attribute in the API needs to map to attribute in Terraform. Generated files from templating can be broken with illegal syntax. When a provider adds new attributes the terraforming code needs to be updated.
Terraformer instead uses Terraform provider files for mapping attributes, HCL library from Hashicorp, and Terraform code.
Look for S3 support in terraforming here and official S3 support
Terraforming lacks full coverage for resources - as an example you can see that 70% of S3 options are not supported:
Đọc thêm về GoogleCloudPlatform/terraformer ở đâu?
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/GoogleCloudPlatform/terraformer là nguồn chính thức.
GoogleCloudPlatform/terraformer có những chủ đề gì?
GoogleCloudPlatform/terraformer có phải mã nguồn mở không?
Có — GoogleCloudPlatform/terraformer phát hành theo license Apache-2.0, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/GoogleCloudPlatform/terraformer.
GoogleCloudPlatform/terraformer có website riêng không?
TopGit chưa ghi nhận URL trang chủ cho GoogleCloudPlatform/terraformer. Phần README ở tab phía trên thường có link demo, hoặc xem mô tả GitHub của repo.
GoogleCloudPlatform/terraformer còn đang phát triển không?
Commit gần nhất trên GoogleCloudPlatform/terraformer là 8 tháng trước (theo timestamp GitHub). Repo có 1.8k fork — một chỉ báo về mức độ quan tâm của cộng đồng.
GoogleCloudPlatform/terraformer dùng license gì?
GoogleCloudPlatform/terraformer phát hành theo license Apache-2.0. Nên mở file LICENSE trên GitHub để xác nhận — license metadata đôi khi lệch với thực tế dự án.
Đọc đầy đủ README ở tab phía trên.
Muốn nghe thêm một ý kiến về terraformer?
Hỏi một AI đọc được trang này — một cú bấm là có ngay nhận định về terraformer.