[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-7775":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":12,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":15,"stars7d":15,"stars30d":15,"stars90d":15,"forks30d":15,"starsTrendScore":15,"compositeScore":16,"rankGlobal":10,"rankLanguage":10,"license":17,"archived":18,"fork":19,"defaultBranch":20,"hasWiki":19,"hasPages":18,"topics":21,"createdAt":10,"pushedAt":10,"updatedAt":26,"readmeContent":27,"aiSummary":28,"trendingCount":15,"starSnapshotCount":15,"syncStatus":29,"lastSyncTime":30,"discoverSource":31},7775,"terraforming","dtan4\u002Fterraforming","dtan4","Export existing AWS resources to Terraform style (tf, tfstate) \u002F No longer actively maintained","http:\u002F\u002Fterraforming.dtan4.net\u002F",null,"Ruby",4260,636,114,0,60.41,"MIT License",true,false,"master",[22,23,24,25],"aws","ruby-gem","terraform","tfstate","2026-06-12 04:00:35","# Terraforming\n\n## Project Status (2021-12-11): No longer actively maintained\n\nTerraforming is no longer actively maintained.\n\n**If you want to generate Terraform configurations from existing cloud resources,** consider using other tools, such as\n\n- [Terraformer](https:\u002F\u002Fgithub.com\u002FGoogleCloudPlatform\u002Fterraformer) which supports many cloud providers not only AWS but also GCP, Azure, GitHub, Kubernetes, etc., and is able to generate configurations based on the latest provider's resource schema.\n- [Terracognita](https:\u002F\u002Fgithub.com\u002Fcycloidio\u002Fterracognita)\n\nThank you for your contributions and supports in the past 6 years.\n\n---\n\n[![Build Status](https:\u002F\u002Ftravis-ci.org\u002Fdtan4\u002Fterraforming.svg?branch=master)](https:\u002F\u002Ftravis-ci.org\u002Fdtan4\u002Fterraforming)\n[![Code Climate](https:\u002F\u002Fcodeclimate.com\u002Fgithub\u002Fdtan4\u002Fterraforming\u002Fbadges\u002Fgpa.svg)](https:\u002F\u002Fcodeclimate.com\u002Fgithub\u002Fdtan4\u002Fterraforming)\n[![Coverage Status](https:\u002F\u002Fcoveralls.io\u002Frepos\u002Fgithub\u002Fdtan4\u002Fterraforming\u002Fbadge.svg?branch=increase-test-cov-160528)](https:\u002F\u002Fcoveralls.io\u002Fgithub\u002Fdtan4\u002Fterraforming)\n[![Gem Version](https:\u002F\u002Fbadge.fury.io\u002Frb\u002Fterraforming.svg)](http:\u002F\u002Fbadge.fury.io\u002Frb\u002Fterraforming)\n[![MIT License](http:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-MIT-blue.svg?style=flat)](LICENSE)\n[![Docker Repository on Quay.io](https:\u002F\u002Fquay.io\u002Frepository\u002Fdtan4\u002Fterraforming\u002Fstatus \"Docker Repository on Quay.io\")](https:\u002F\u002Fquay.io\u002Frepository\u002Fdtan4\u002Fterraforming)\n\nExport existing AWS resources to [Terraform](https:\u002F\u002Fterraform.io\u002F) style (tf, tfstate)\n\n- [Supported version](#supported-version)\n- [Installation](#installation)\n- [Prerequisites](#prerequisites)\n- [Usage](#usage)\n  -  [Export tf](#export-tf)\n  -  [Export tfstate](#export-tfstate)\n    -  [Example: Export all](#example-export-all)\n- [Run as Docker container](#run-as-docker-container-)\n- [Development](#development)\n- [Contributing](#contributing)\n- [Similar projects](#similar-projects)\n- [License](#license)\n\n## Supported version\n\n- Ruby 2.3 or higher is required\n- Terraform v0.9.3 or higher is recommended\n  - Some resources (e.g. `iam_instance_profile`) uses newer resource specification\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'terraforming'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install terraforming\n\n## Prerequisites\n\nYou need to set AWS credentials.\n\n```bash\nexport AWS_ACCESS_KEY_ID=XXXXXXXXXXXXXXXXXXXX\nexport AWS_SECRET_ACCESS_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\nexport AWS_REGION=xx-yyyy-0\n```\n\nYou can also specify credential profile in `~\u002F.aws\u002Fcredentials` by `--profile` option.\n\n```bash\n$ cat ~\u002F.aws\u002Fcredentials\n[hoge]\naws_access_key_id = Hoge\naws_secret_access_key = FugaFuga\n\n# Pass profile name by --profile option\n$ terraforming s3 --profile hoge\n```\n\nYou can assume a role by using the `--assume` option.\n\n```bash\n$ terraforming s3 --assume arn:aws:iam::123456789123:role\u002Ftest-role\n```\n\nYou can force the AWS SDK to utilize the CA certificate that is bundled with the SDK for systems where the default OpenSSL certificate is not installed (e.g. Windows) by utilizing the `--use-bundled-cert` option.\n\n```bash\nPS C:\\> terraforming ec2 --use-bundled-cert\n```\n\n## Usage\n\n```bash\n$ terraforming\nCommands:\n  terraforming alb             # ALB\n  terraforming asg             # AutoScaling Group\n  terraforming cwa             # CloudWatch Alarm\n  terraforming dbpg            # Database Parameter Group\n  terraforming dbsg            # Database Security Group\n  terraforming dbsn            # Database Subnet Group\n  terraforming ddb             # DynamoDB\n  terraforming ec2             # EC2\n  terraforming ecc             # ElastiCache Cluster\n  terraforming ecsn            # ElastiCache Subnet Group\n  terraforming efs             # EFS File System\n  terraforming eip             # EIP\n  terraforming elb             # ELB\n  terraforming help [COMMAND]  # Describe available commands or one specific command\n  terraforming iamg            # IAM Group\n  terraforming iamgm           # IAM Group Membership\n  terraforming iamgp           # IAM Group Policy\n  terraforming iamip           # IAM Instance Profile\n  terraforming iamp            # IAM Policy\n  terraforming iampa           # IAM Policy Attachment\n  terraforming iamr            # IAM Role\n  terraforming iamrp           # IAM Role Policy\n  terraforming iamu            # IAM User\n  terraforming iamup           # IAM User Policy\n  terraforming igw             # Internet Gateway\n  terraforming kmsa            # KMS Key Alias\n  terraforming kmsk            # KMS Key\n  terraforming lc              # Launch Configuration\n  terraforming nacl            # Network ACL\n  terraforming nat             # NAT Gateway\n  terraforming nif             # Network Interface\n  terraforming r53r            # Route53 Record\n  terraforming r53z            # Route53 Hosted Zone\n  terraforming rds             # RDS\n  terraforming rs              # Redshift\n  terraforming rt              # Route Table\n  terraforming rta             # Route Table Association\n  terraforming s3              # S3\n  terraforming sg              # Security Group\n  terraforming sn              # Subnet\n  terraforming snst            # SNS Topic\n  terraforming snss            # SNS Subscription\n  terraforming sqs             # SQS\n  terraforming vgw             # VPN Gateway\n  terraforming vpc             # VPC\n\nOptions:\n  [--merge=MERGE]                                # tfstate file to merge\n  [--overwrite], [--no-overwrite]                # Overwrite existng tfstate\n  [--tfstate], [--no-tfstate]                    # Generate tfstate\n  [--profile=PROFILE]                            # AWS credentials profile\n  [--region=REGION]                              # AWS region\n  [--use-bundled-cert], [--no-use-bundled-cert]  # Use the bundled CA certificate from AWS SDK\n```\n\n### Export tf\n\n```bash\n$ terraforming \u003Cresource> [--profile PROFILE]\n```\n\n(e.g. S3 buckets):\n\n```bash\n$ terraforming s3\n```\n\n```hcl\nresource \"aws_s3_bucket\" \"hoge\" {\n    bucket = \"hoge\"\n    acl    = \"private\"\n}\n\nresource \"aws_s3_bucket\" \"fuga\" {\n    bucket = \"fuga\"\n    acl    = \"private\"\n}\n```\n\n### Export tfstate\n\n```bash\n$ terraforming \u003Cresource> --tfstate [--merge TFSTATE_PATH] [--overwrite] [--profile PROFILE]\n```\n\n(e.g. S3 buckets):\n\n```bash\n$ terraforming s3 --tfstate\n```\n\n```json\n{\n  \"version\": 1,\n  \"serial\": 1,\n  \"modules\": {\n    \"path\": [\n      \"root\"\n    ],\n    \"outputs\": {\n    },\n    \"resources\": {\n      \"aws_s3_bucket.hoge\": {\n        \"type\": \"aws_s3_bucket\",\n        \"primary\": {\n          \"id\": \"hoge\",\n          \"attributes\": {\n            \"acl\": \"private\",\n            \"bucket\": \"hoge\",\n            \"id\": \"hoge\"\n          }\n        }\n      },\n      \"aws_s3_bucket.fuga\": {\n        \"type\": \"aws_s3_bucket\",\n        \"primary\": {\n          \"id\": \"fuga\",\n          \"attributes\": {\n            \"acl\": \"private\",\n            \"bucket\": \"fuga\",\n            \"id\": \"fuga\"\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nIf you want to merge exported tfstate to existing `terraform.tfstate`, specify `--tfstate --merge=\u002Fpath\u002Fto\u002Fterraform.tfstate` option.\nYou can overwrite existing `terraform.tfstate` by specifying `--overwrite` option together.\n\nExisting `terraform.tfstate`:\n\n```bash\n# \u002Fpath\u002Fto\u002Fterraform.tfstate\n\n{\n  \"version\": 1,\n  \"serial\": 88,\n  \"remote\": {\n    \"type\": \"s3\",\n    \"config\": {\n      \"bucket\": \"terraforming-tfstate\",\n      \"key\": \"tf\"\n    }\n  },\n  \"modules\": {\n    \"path\": [\n      \"root\"\n    ],\n    \"outputs\": {\n    },\n    \"resources\": {\n      \"aws_elb.hogehoge\": {\n        \"type\": \"aws_elb\",\n        \"primary\": {\n          \"id\": \"hogehoge\",\n          \"attributes\": {\n            \"availability_zones.#\": \"2\",\n            \"connection_draining\": \"true\",\n            \"connection_draining_timeout\": \"300\",\n            \"cross_zone_load_balancing\": \"true\",\n            \"dns_name\": \"hoge-12345678.ap-northeast-1.elb.amazonaws.com\",\n            \"health_check.#\": \"1\",\n            \"id\": \"hogehoge\",\n            \"idle_timeout\": \"60\",\n            \"instances.#\": \"1\",\n            \"listener.#\": \"1\",\n            \"name\": \"hoge\",\n            \"security_groups.#\": \"2\",\n            \"source_security_group\": \"default\",\n            \"subnets.#\": \"2\"\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nTo generate merged tfstate:\n\n```bash\n$ terraforming s3 --tfstate --merge=\u002Fpath\u002Fto\u002Ftfstate\n```\n\n```json\n{\n  \"version\": 1,\n  \"serial\": 89,\n  \"remote\": {\n    \"type\": \"s3\",\n    \"config\": {\n      \"bucket\": \"terraforming-tfstate\",\n      \"key\": \"tf\"\n    }\n  },\n  \"modules\": {\n    \"path\": [\n      \"root\"\n    ],\n    \"outputs\": {\n    },\n    \"resources\": {\n      \"aws_elb.hogehoge\": {\n        \"type\": \"aws_elb\",\n        \"primary\": {\n          \"id\": \"hogehoge\",\n          \"attributes\": {\n            \"availability_zones.#\": \"2\",\n            \"connection_draining\": \"true\",\n            \"connection_draining_timeout\": \"300\",\n            \"cross_zone_load_balancing\": \"true\",\n            \"dns_name\": \"hoge-12345678.ap-northeast-1.elb.amazonaws.com\",\n            \"health_check.#\": \"1\",\n            \"id\": \"hogehoge\",\n            \"idle_timeout\": \"60\",\n            \"instances.#\": \"1\",\n            \"listener.#\": \"1\",\n            \"name\": \"hoge\",\n            \"security_groups.#\": \"2\",\n            \"source_security_group\": \"default\",\n            \"subnets.#\": \"2\"\n          }\n        }\n      },\n      \"aws_s3_bucket.hoge\": {\n        \"type\": \"aws_s3_bucket\",\n        \"primary\": {\n          \"id\": \"hoge\",\n          \"attributes\": {\n            \"acl\": \"private\",\n            \"bucket\": \"hoge\",\n            \"id\": \"hoge\"\n          }\n        }\n      },\n      \"aws_s3_bucket.fuga\": {\n        \"type\": \"aws_s3_bucket\",\n        \"primary\": {\n          \"id\": \"fuga\",\n          \"attributes\": {\n            \"acl\": \"private\",\n            \"bucket\": \"fuga\",\n            \"id\": \"fuga\"\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nAfter writing exported tf and tfstate to files, execute `terraform plan` and check the result.\nThere should be no diff.\n\n```bash\n$ terraform plan\nNo changes. Infrastructure is up-to-date. This means that Terraform\ncould not detect any differences between your configuration and\nthe real physical resources that exist. As a result, Terraform\ndoesn't need to do anything.\n```\n\n#### Example: Export all\nExample assuming you want to export everything from us-west-2 and you are using ~\u002F.aws\u002Fcredentials with a `default` profile\n```bash\nexport AWS_REGION=us-west-2\nterraforming help | grep terraforming | grep -v help | awk '{print \"terraforming\", $2, \"--profile\", \"default\", \">\", $2\".tf\";}' | bash\n# find files that only have 1 empty line (likely nothing in AWS)\nfind . -type f -name '*.tf' | xargs wc -l | grep ' 1 .'\n```\n\n### Caveats\n\n- `terraforming kmsk` does not export EXTERNAL origin key, bacause Terraform does not support it.\n\n## Run as Docker container [![Docker Repository on Quay.io](https:\u002F\u002Fquay.io\u002Frepository\u002Fdtan4\u002Fterraforming\u002Fstatus \"Docker Repository on Quay.io\")](https:\u002F\u002Fquay.io\u002Frepository\u002Fdtan4\u002Fterraforming)\n\nTerraforming Docker Image is available at [quay.io\u002Fdtan4\u002Fterraforming](https:\u002F\u002Fquay.io\u002Frepository\u002Fdtan4\u002Fterraforming) and developed at [dtan4\u002Fdockerfile-terraforming](https:\u002F\u002Fgithub.com\u002Fdtan4\u002Fdockerfile-terraforming).\n\nPull the Docker image:\n\n```bash\n$ docker pull quay.io\u002Fdtan4\u002Fterraforming:latest\n```\n\nAnd then run Terraforming as a Docker container:\n\n```bash\n$ docker run \\\n    --rm \\\n    --name terraforming \\\n    -e AWS_ACCESS_KEY_ID=XXXXXXXXXXXXXXXXXXXX \\\n    -e AWS_SECRET_ACCESS_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx \\\n    -e AWS_REGION=xx-yyyy-0 \\\n    quay.io\u002Fdtan4\u002Fterraforming:latest \\\n    terraforming s3\n```\n\n## Development\n\nAfter checking out the repo, run `script\u002Fsetup` to install dependencies. Then, run `script\u002Fconsole` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https:\u002F\u002Frubygems.org).\n\n## Contributing\n\nPlease read [Contribution Guide](CONTRIBUTING.md) at first.\n\n1. Fork it ( https:\u002F\u002Fgithub.com\u002Fdtan4\u002Fterraforming\u002Ffork )\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Similar projects\n\nThere are some similar tools to import your existing infrastructure to Terraform configuration.\n\n- [GoogleCloudPlatform\u002Fterraformer](https:\u002F\u002Fgithub.com\u002FGoogleCloudPlatform\u002Fterraformer)\n- [cycloidio\u002Fterracognita](https:\u002F\u002Fgithub.com\u002Fcycloidio\u002Fterracognita\u002F)\n\n## License\n\n[![MIT License](http:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-MIT-blue.svg?style=flat)](LICENSE)\n","Terraforming 是一个用于将现有的 AWS 资源导出为 Terraform 格式（tf, tfstate）的工具。它主要通过 Ruby 语言开发，能够帮助用户快速地将手动创建或通过其他方式管理的 AWS 基础设施转换成可版本控制的 Terraform 配置文件。虽然该项目已经不再积极维护，但仍然适用于需要将现有 AWS 环境迁移到 Terraform 管理下的场景。使用时需确保安装了兼容版本的 Ruby 和 Terraform，并正确配置 AWS 访问凭证。",2,"2026-06-11 03:14:18","top_language"]