{"id":13505879,"url":"https://github.com/ysoftwareab/tfrepl","last_synced_at":"2025-03-30T00:31:51.387Z","repository":{"id":153224677,"uuid":"628501876","full_name":"ysoftwareab/tfrepl","owner":"ysoftwareab","description":"A terraform REPL.","archived":false,"fork":false,"pushed_at":"2023-06-11T20:20:52.000Z","size":4147,"stargazers_count":30,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T09:10:06.025Z","etag":null,"topics":[],"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/ysoftwareab.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}},"created_at":"2023-04-16T06:20:00.000Z","updated_at":"2024-06-03T00:32:17.000Z","dependencies_parsed_at":"2023-07-11T09:01:48.737Z","dependency_job_id":null,"html_url":"https://github.com/ysoftwareab/tfrepl","commit_stats":null,"previous_names":["ysoftwareab/tfrepl"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ysoftwareab%2Ftfrepl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ysoftwareab%2Ftfrepl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ysoftwareab%2Ftfrepl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ysoftwareab%2Ftfrepl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ysoftwareab","download_url":"https://codeload.github.com/ysoftwareab/tfrepl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246262491,"owners_count":20749170,"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-08-01T00:01:16.073Z","updated_at":"2025-03-30T00:31:46.372Z","avatar_url":"https://github.com/ysoftwareab.png","language":"Shell","funding_links":[],"categories":["Tools"],"sub_categories":["Community providers"],"readme":"# tfrepl\n\nA terraform REPL.\n\n```text\n$ tfrepl\nWelcome to tfrepl 0.0.1.\nType '.help' for more information.\n\u003e .help\n.config       Print the REPL terraform config\n.exit         Exit the REPL\n.help         Print this help message\n.history      Print the history of REPL commands\n.save         Save the REPL terraform config\n.undo         Undo last command from the REPL terraform config\n.upgrade      Upgrade REPL to the latest version\n\n.\u003cwhatever\u003e   Bash evaluate whatever you want\n              For example, '.echo 123' will print 123\n              Or '.ls' will list contents of the current working directory, etc.\n\nYour REPL commands end up as tfrepl.tf and tfrepl_override.tf.\nYour REPL history is being recorded to .terraform/tfrepl.history.\nMultiple lines are recorded until curly braces are balanced.\n```\n\n**NOTE** Need `tfrepl_override.tf` in order to override existing config.\nNeed `tfrepl.tf` because `tfrepl_override.tf` can only override, but not add to the existing config.\n\n## Demo\n\n![ttyrecord](./demo/tty.gif)\n\n## Install\n\nAssuming that `/usr/local/bin` is in your `$PATH`, install via:\n\n```bash\ncurl -fqsSL -o /usr/local/bin/tfrepl https://github.com/ysoftwareab/tfrepl/releases/latest/download/tfrepl\nchmod +x /usr/local/bin/tfrepl\n```\n\nYou can also install `tfrepl` via npm/pnpm/yarn:\n\n```bash\nnpm i -g ysoftwareab/tfrepl\npnpm add -g ysoftwareab/tfrepl\nyarn global add ysoftwareab/tfrepl\n```\n\n## Basic usage\n\nCall `tfrepl` inside a terraform module/project directory.\n\nYou can then start adding terraform config such as `locals {test=true}`.\n\nAnd check the state as `local.test` will print `true`. Try with other locals, variables or outputs.\n\nCheck your config with `.config` and undo one command at a time with `.undo`.\n\nIf your config is ephemeral, just `.exit`. Whenever you want to take snapshots of your config, just `.save`.\n\n## Known limitations\n\n* config gets evaluated when blocks seem complete\n  i.e. number of closed curly braces is greater or equal with number of open curly braces.\n  If you were to have a string with an open curly brace,\n  then `tfrepl` wouldn't know when your blocks are complete.\n\n## Easter egg: `tfwatch`\n\nAssuming that `/usr/local/bin` is in your `$PATH`, install via:\n\n```bash\ncurl -fqsSL -o /usr/local/bin/tfwatch https://github.com/ysoftwareab/tfrepl/releases/latest/download/tfwatch\nchmod +x /usr/local/bin/tfwatch\n```\n\nYou can also install `tfwatch` via npm/pnpm/yarn:\n\n```bash\nnpm i -g ysoftwareab/tfrepl\npnpm add -g ysoftwareab/tfrepl\nyarn global add ysoftwareab/tfrepl\n```\n\nRun `tfwatch local.test` and start modifying your terraform files to include `local.test` e.g. `locals {test=true}`,\nyou'll see the value being updated in the `tfwatch` output,\nso that you check whether it matches your intentions/expectations or not.\n\nYou can pass any expression e.g. `concat(module.foo.value, module.bar.value)`.\n\n## Development\n\nReleasing new version is as easy as running `priv/release`\nto release a new patch version. For minor/major, run `priv/release minor|major`.\n\n## Alternative/s\n\nhttps://github.com/paololazzari/terraform-repl is another terraform REPL.\nWhen trying it out, I got surprised with requests to install docker, socat.\nEven with all the dependencies met, I was greeted with a\n`Something went wrong: the docker container backend could not start` message,\nand a dirty locked-out state: all retries to start the REPL end in\n`A terraform console process is already running here`.\nNow I had to learn which docker container to kill and which lockfile to delete.\nRunning without docker `terraform-repl -no-docker-container-backend` works,\nbut now you need jq and hcl2json.\nSince it doesn't align well with One Thing Well :tm:,\npatching it lost in favour of starting fresh and `tfrepl` was born.\n\nDifferences\n* :heavy_plus_sign: `tfrepl` has slim dependencies\n  like basic Unix tools (`bash`, `sed`, `grep`, etc) and `terraform`\n* :heavy_plus_sign: `tfrepl` supports multiline config\n* :heavy_plus_sign: `tfrepl` sandboxes history to each .terraform folder\n* :heavy_plus_sign: `tfrepl` introduces a specific syntax for commands: leading `.`\n* :heavy_minus_sign: `terraform-repl` has a `local` command showing all local variables.\n\n## License\n\n[Apache 2.0](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fysoftwareab%2Ftfrepl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fysoftwareab%2Ftfrepl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fysoftwareab%2Ftfrepl/lists"}