{"id":22998244,"url":"https://github.com/uswitch/terrafying","last_synced_at":"2025-04-09T13:06:58.599Z","repository":{"id":49972747,"uuid":"63867822","full_name":"uswitch/terrafying","owner":"uswitch","description":"A small ruby dsl for terraform.","archived":false,"fork":false,"pushed_at":"2024-04-24T12:37:58.000Z","size":350,"stargazers_count":61,"open_issues_count":10,"forks_count":4,"subscribers_count":64,"default_branch":"master","last_synced_at":"2024-04-24T16:24:23.679Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/uswitch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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":"2016-07-21T12:33:39.000Z","updated_at":"2024-04-24T16:24:23.680Z","dependencies_parsed_at":"2024-11-14T00:17:23.904Z","dependency_job_id":"c77d9c8b-8862-4dde-ad53-c511dd4e6708","html_url":"https://github.com/uswitch/terrafying","commit_stats":{"total_commits":245,"total_committers":26,"mean_commits":9.423076923076923,"dds":0.5224489795918368,"last_synced_commit":"e87f88fb765d9a6bab87529b6c8a0683a68d7d69"},"previous_names":[],"tags_count":44,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uswitch%2Fterrafying","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uswitch%2Fterrafying/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uswitch%2Fterrafying/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uswitch%2Fterrafying/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uswitch","download_url":"https://codeload.github.com/uswitch/terrafying/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248045231,"owners_count":21038553,"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":[],"created_at":"2024-12-15T06:12:23.080Z","updated_at":"2025-04-09T13:06:58.574Z","avatar_url":"https://github.com/uswitch.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# terrafying\n\nA small ruby dsl for [terraform](https://www.terraform.io), based on [terrafied](https://github.com/thattommyhall/terrafied).\n\n## Setup\n\n- Ruby 2.2:ish\n- Terraform with the right version: https://www.terraform.io/downloads.html\n  - OSX: `brew install terraform`\n- `bundle install`\n\n###\n\n`Terraform::CLI_VERSION` checks for the correct version of terraform. Due to Hashicorp continually releasing versions and sometimes with breaking changes / bugs, we have locked the terraform version. As terraform continues to get updated we will attempt to keep this version up-to-date with the latest stable version of terraform.\n\n## Usage\n\nThe `terrafying` command is in `bin`:\n\n```\n$ ./bin/terrafying\nCommands:\n  terrafying apply PATH             # Apply changes to resources\n  terrafying destroy PATH           # Destroy resources\n  terrafying graph PATH             # Show execution graph\n  terrafying help [COMMAND]         # Describe available commands or one specific command\n  terrafying import PATH ADDR ID    # Import existing infrastructure into your Terraform state\n  terrafying json PATH              # Show terraform JSON\n  terrafying list PATH              # List resources defined\n  terrafying plan PATH              # Show execution plan\n  terrafying show-state PATH        # Show state\n  terrafying use-local-state PATH   # Migrate to using local state storage\n  terrafying use-remote-state PATH  # Migrate to using remote state storage\n\nOptions:\n  [--no-lock], [--no-no-lock]\n  [--keep], [--no-keep]\n  [--target=TARGET]\n```\n\n### Creating a specification\n\nCreate ruby file somewhere and declare resources as you wish.\n\nFor example `example/main.rb`\n\n```ruby\nTerrafying::Generator.generate {\n  aws_security_group \"example_group\", {\n    name: \"example_group\",\n    description: \"Allow all inbound traffic to port 80\",\n    vpc_id: 'vpc-ec0c118e',\n\n    ingress: {\n      from_port: 80,\n      to_port: 80,\n      protocol: \"tcp\",\n      cidr_blocks: [\"0.0.0.0/0\"],\n    }\n  }\n}\n```\n\n### Showing changes\n\nRun `./bin/terrafying plan example/main.rb`:\n\n```\n$ ./bin/terrafying plan example/main.rb\nRefreshing Terraform state prior to plan...\n\n\nThe Terraform execution plan has been generated and is shown below.\nResources are shown in alphabetical order for quick scanning. Green resources\nwill be created (or destroyed and then created if an existing resource\nexists), yellow resources are being changed in-place, and red resources\nwill be destroyed.\n\nNote: You didn't specify an \"-out\" parameter to save this plan, so when\n\"apply\" is called, Terraform can't guarantee this is what will execute.\n\n+ aws_security_group.example_group\n    description:                          \"\" =\u003e \"Allow all inbound traffic to port 80\"\n    egress.#:                             \"\" =\u003e \"\u003ccomputed\u003e\"\n    ingress.#:                            \"\" =\u003e \"1\"\n    ingress.2214680975.cidr_blocks.#:     \"\" =\u003e \"1\"\n    ingress.2214680975.cidr_blocks.0:     \"\" =\u003e \"0.0.0.0/0\"\n    ingress.2214680975.from_port:         \"\" =\u003e \"80\"\n    ingress.2214680975.protocol:          \"\" =\u003e \"tcp\"\n    ingress.2214680975.security_groups.#: \"\" =\u003e \"0\"\n    ingress.2214680975.self:              \"\" =\u003e \"0\"\n    ingress.2214680975.to_port:           \"\" =\u003e \"80\"\n    name:                                 \"\" =\u003e \"example_group\"\n    owner_id:                             \"\" =\u003e \"\u003ccomputed\u003e\"\n    vpc_id:                               \"\" =\u003e \"vpc-ec0c118e\"\n\n\nPlan: 1 to add, 0 to change, 0 to destroy.\n```\n\n\n### Applying changes\n\nRun `./bin/terrafying apply`\n\n```\n$ ./bin/terrafying apply example/main.rb\naws_security_group.example_group: Creating...\n  description:                          \"\" =\u003e \"Allow all inbound traffic to port 80\"\n  egress.#:                             \"\" =\u003e \"\u003ccomputed\u003e\"\n  ingress.#:                            \"\" =\u003e \"1\"\n  ingress.2214680975.cidr_blocks.#:     \"\" =\u003e \"1\"\n  ingress.2214680975.cidr_blocks.0:     \"\" =\u003e \"0.0.0.0/0\"\n  ingress.2214680975.from_port:         \"\" =\u003e \"80\"\n  ingress.2214680975.protocol:          \"\" =\u003e \"tcp\"\n  ingress.2214680975.security_groups.#: \"\" =\u003e \"0\"\n  ingress.2214680975.self:              \"\" =\u003e \"0\"\n  ingress.2214680975.to_port:           \"\" =\u003e \"80\"\n  name:                                 \"\" =\u003e \"example_group\"\n  owner_id:                             \"\" =\u003e \"\u003ccomputed\u003e\"\n  vpc_id:                               \"\" =\u003e \"vpc-ec0c118e\"\naws_security_group.example_group: Creation complete\n\nApply complete! Resources: 1 added, 0 changed, 0 destroyed.\n\nThe state of your infrastructure has been saved to the path\nbelow. This state is required to modify and destroy your\ninfrastructure, so keep it safe. To inspect the complete state\nuse the `terraform show` command.\n\nState path: terraform.tfstate\n```\n\n## Locking\n\nTo prevent concurrent changes to infrastructure any operations that\nmutate resources (apply/delete) are done under a distributed lock.\n\nIf an operation fails completely or partially, you may be left still\nholding the lock. This is intended behaviour and will allow you to fix\nyour specifications and continue applying your changes until you reach a\nconsistent state.\n\nIf you or someone else has a lock that you want to re-acquire or steal\n(if you deem it safe to do so) you can use the `-f` flag.\n\n```\n$ ./bin/terrafying apply -f example/main.rb\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuswitch%2Fterrafying","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuswitch%2Fterrafying","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuswitch%2Fterrafying/lists"}