{"id":13505845,"url":"https://github.com/paololazzari/terraform-repl","last_synced_at":"2025-10-09T08:58:09.404Z","repository":{"id":144681624,"uuid":"580424589","full_name":"paololazzari/terraform-repl","owner":"paololazzari","description":"A terraform console wrapper for a better REPL experience","archived":false,"fork":false,"pushed_at":"2024-11-30T18:53:19.000Z","size":54,"stargazers_count":129,"open_issues_count":3,"forks_count":9,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-30T00:31:59.446Z","etag":null,"topics":["repl","terraform"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paololazzari.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","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":"2022-12-20T14:27:49.000Z","updated_at":"2025-03-27T20:42:48.000Z","dependencies_parsed_at":"2023-11-15T18:27:23.077Z","dependency_job_id":"1ca83134-a860-48a1-9f64-a16e06cbd891","html_url":"https://github.com/paololazzari/terraform-repl","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/paololazzari/terraform-repl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paololazzari%2Fterraform-repl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paololazzari%2Fterraform-repl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paololazzari%2Fterraform-repl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paololazzari%2Fterraform-repl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paololazzari","download_url":"https://codeload.github.com/paololazzari/terraform-repl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paololazzari%2Fterraform-repl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001049,"owners_count":26082993,"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","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["repl","terraform"],"created_at":"2024-08-01T00:01:15.273Z","updated_at":"2025-10-09T08:58:09.366Z","avatar_url":"https://github.com/paololazzari.png","language":"Shell","funding_links":[],"categories":["Tools"],"sub_categories":["Community providers"],"readme":"# terraform-repl\n\nterraform-repl is a terraform console wrapper that aims at providing a better interactive console for evaluating Terraform language expressions.\n\n## Motivation\n\nThe standard terraform console has several limitations, including:\n\n- No tab completion\n- No ability to view all objects\n- No ability to define variables\n- No ability to view command history\n- No ability to clear screen\n- No ability to run system commands\n\nterraform-repl provides a solution to these problems.\n\n## How it works\n\nBy default, terraform-repl evaluates each expression against a new terraform console process.\n\nYou can, however, choose to use a hashicorp/terraform docker container as a single background process to evaluate the expressions entered. This can be faster if working with terraform projects of a certain size. You can enable the container backend by using the `-docker-container-backend` option.\n\n## Usage\n\n### Starting the REPL\n\nTo start the REPL:\n\n```bash\n$ terraform-repl\n\u003e\n```\n\nor with the container backend:\n\n```bash\n$ terraform-repl -docker-container-backend\nStarting terraform console docker container...\n```\n\nor starting the terraform-repl docker container:\n\n```bash\n$ docker run --rm -it -v \"$(pwd)\":/data plazzari/terraform-repl\n\u003e\n```\n\n### Using the REPL\n\nGiven the following `main.tf` file:\n\n```terraform\nlocals {\n  a = \"foo\"\n  b = {\"nums\": [\n    1,\n    2\n  ]}\n}\n```\n\n\nTo inspect the `locals`:\n\n```bash\n\u003e local\n[\n  {\n    \"a\": \"foo\",\n    \"b\": {\n      \"nums\": [\n        1,\n        2\n      ]\n    }\n  }\n]\n```\n\nTo inspect one value:\n\n```bash\n\u003e local.b.nums[0]\n1\n```\n\nTo create new variables:\n\n```bash\n\u003e local.c=\"example\"\n\u003e local.c\n\"example\"\n\u003e local.d={\"nums\": \\\n[ 3, 4 ] \\\n}\n\u003e local.d\n{\n  \"nums\" = [\n    3,\n    4,\n  ]\n}\n```\n\nTo view the command history:\n\n```bash\n\u003e history\n    1  local\n    2  local.b.nums[0]\n    3  local.c=\"example\"\n    4  local.c\n    5  local.d={\"nums\": [ 3, 4 ] }\n    6  local.d\n    7  history\n```\n\nAll terraform functions can be run as usual:\n\n```bash\n\u003e element(local.d.nums,0)\n3\n```\n\nTo run an external command, prepend the command with `!`:\n\n```bash\n\u003e !grep \"locals\" main.tf\nlocals {\n```\n\nTo clear the screen:\n\n```bash\n\u003e clear\n```\n\nTo exit:\n\n```bash\n\u003e exit\n```\n\n\n### Tab completion\n\nYou can use the TAB key to get autocompletion for terraform functions:\n\n```bash\n\u003e e\u003cTAB\u003e\nendswith element\n\u003e el\u003cTAB\u003e\n\u003e element\n```\n\nas well as for `local` variables:\n\n```bash\n\u003e local.\u003cTAB\u003e\nlocal.a  local.b.nums[0]  local.b.nums[1]\n```\n\nthis can be useful when you are working with many `local` variables.\n\n### Transcript\n\nWhen you start the REPL you may also specify the `-transcript` option. This will generate a transcript of all inputs and outputs of the session.\nFor the commands demonstrated above, the transcript file would be as follows:\n\n\u003cdetails\u003e\n    \u003csummary\u003eSample transcript\u003c/summary\u003e\n\n    \u003e local\n    [\n      {\n        \"a\": \"foo\",\n        \"b\": {\n          \"nums\": [\n            1,\n            2\n          ]\n        }\n      }\n    ]\n    \u003e local.b.nums[0]\n    1\n    \u003e local.c=\"example\"\n    \u003e local.c\n    \"example\"\n    \u003e local.d={\"nums\": [ 3, 4 ] }\n    \u003e local.d\n    {\n      \"nums\" = [\n        3,\n        4,\n      ]\n    }\n    \u003e element(local.d.nums,0)\n    3\n\n\u003c/details\u003e\n\n\n## Prerequisites\n\n- [jq](https://github.com/stedolan/jq)\n- [hcl2json](https://github.com/tmccombs/hcl2json)\n- [docker*](https://docs.docker.com/desktop/install/linux-install/)\n- socat*\n\n\\* optional, although highly recommended\n\n## Installation\n\n```bash\n$ curl -O https://raw.githubusercontent.com/paololazzari/terraform-repl/master/terraform-repl\n$ cp terraform-repl /usr/local/bin/\n$ chmod +x /usr/local/bin/terraform-repl\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaololazzari%2Fterraform-repl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaololazzari%2Fterraform-repl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaololazzari%2Fterraform-repl/lists"}