{"id":24866474,"url":"https://github.com/eieste/tfutility","last_synced_at":"2025-10-15T11:30:36.383Z","repository":{"id":258356373,"uuid":"859883588","full_name":"eieste/tfutility","owner":"eieste","description":"tfutility allows performing commands on terraform/tofu files. This commands can be different things. Currently, there are possibilities to check if a module block has remote sources. Or  import or moved blocks have creation dates on them.","archived":false,"fork":false,"pushed_at":"2025-01-20T14:14:07.000Z","size":5461,"stargazers_count":3,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-27T05:28:21.974Z","etag":null,"topics":["command-line-tool","development","pre-commit-hook","python","terraform","tofu","utility"],"latest_commit_sha":null,"homepage":"https://github.com/eieste/tfutility","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eieste.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2024-09-19T12:54:33.000Z","updated_at":"2024-12-19T09:30:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"464fcecf-ff4e-43db-840e-155334a31a75","html_url":"https://github.com/eieste/tfutility","commit_stats":null,"previous_names":["eieste/tfrulecheck","eieste/tfutils","eieste/tfutility"],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eieste%2Ftfutility","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eieste%2Ftfutility/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eieste%2Ftfutility/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eieste%2Ftfutility/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eieste","download_url":"https://codeload.github.com/eieste/tfutility/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236604616,"owners_count":19175857,"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":["command-line-tool","development","pre-commit-hook","python","terraform","tofu","utility"],"created_at":"2025-02-01T01:12:00.628Z","updated_at":"2025-10-15T11:30:31.060Z","avatar_url":"https://github.com/eieste.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TfUtility\n\n[![Validate](https://github.com/eieste/tfutility/actions/workflows/validate.yml/badge.svg)](https://github.com/eieste/tfutility/actions/workflows/validate.yml)\n\n\nDocumentation:\n\ntfutility allows performing commands on terraform/tofu files.\nThis commands can be different things. Currently, there are possibilities to check if a module block has remote sources.\nOr  import or moved blocks have creation dates on them.\n\nIt also allows TF-Stack Developers to swap the sources of marked modules.\n\nFor all of these Functions, show the Samples Below or read the [Documentation](https://eieste.github.io/tfutility/)\n\n\n\n## Setup\n\n### Install via PIP\n\nInstall tfutility via pip\n\n```\n$ pip install tfutility\n```\nRun tfutility in command line\n```\n$ tfutility\n```\nfor detailed Examples visit the [Documentation](https://eieste.github.io/tfutility/)\n\n### Use with Docker\n```\ndocker run -it --rm -v $(pwd):/workspace ghcr.io/eieste/tfutility:1.2.1 forcedremotesource /workspace\n```\n\n### Use with pre-commit\n\n\nCreate a .pre-commit-config.yaml with the following content.\n```yaml\n\nrepos:\n  - repo: https://github.com/eieste/tfutility/\n    rev: 1.1.1\n    hooks:\n      - id: check-forcedremotesource\n      - id: check-importdate\n      - id: check-moveddate\n\n```\n\nIts possible to attach the suffix `-docker` to each hook to use precommit docker hooks\n\n\n### Autocompletion\n\nRun the following command to setup a bash autocompletion for this command\n\n```bash\nregister-python-argcomplete tfutilty \u003e /etc/bash_completion.d/tfutilty\n```\n\n## Quick-Reference\n\nThe following Options are currently available\n\n### @importdate\n\nThe importdate decorator should help you to keep your code clean.\nYou should be able to delete imports after the stack has been successfully rolled out. this decorator is useful to avoid removing import blocks too early or forgetting them\n\nExample:\n```terraform\n\n    # @importdate(create=\"01-12-1970\", expire=\"05-01-1971)\n    import {\n        ...\n    }\n\n```\n\nExecute the following command to check if the import was \"expired\"\n```bash\ntfutility importdate /workspace\n```\n\nyou can also overwrite the expire date with your own duration like:\n```bash\ntfutility importdate --expire-after 60 /workspace\n```\nThe `--expire-after` value is in Days.\n\nIf --allow-failure is not set the Application wil exit with `exitcode` 1\nand without --silent it logs all expired imports\n\n\n### @moveddate\n\nThis has the same Reason like @importdate\n\nDecorator in Terraform\n\n```terraform\n\n    # @moveddate(create=\"01-12-1970\", expire=\"05-01-1971)\n    moved {\n        ...\n    }\n\n```\n\nExecute the following command to check if the moved was \"expired\"\n```bash\ntfutility moveddate /workspace\n```\n\n\n### @sourceswap\n\nThis command allows to swap between remote and local sources.\n\n```terraform\n\n    # @sourceswap(remote_version=\"0.0.1\", remote_source=\"example.com/examplemodule/local\", source=\"../../examplemodule\")\n    module {\n        source = \"../../examplemodule\"\n    }\n\n```\n\nTo Swap all Sources in your workspace you can execute the following command\n\n```bash\ntfutility sourceswap --swap-to local /workspace\ntfutility sourceswap --swap-to remote /workspace\n```\n\n\n\n### @forcedremotesource\n\n\nDecorator in Terraform\n\n```terraform\n\n    # @forceremotecheck\n    module {\n        source = \"../\n    }\n\n```\n\nExecute the following command to check if all module blocks has an remote source.\n```bash\ntfutility forcedremotesource /workspace\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feieste%2Ftfutility","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feieste%2Ftfutility","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feieste%2Ftfutility/lists"}