{"id":21261374,"url":"https://github.com/dflook/tofu-fmt","last_synced_at":"2026-01-29T22:37:13.548Z","repository":{"id":204303146,"uuid":"708927633","full_name":"dflook/tofu-fmt","owner":"dflook","description":"GitHub action to fix formatting of OpenTofu files","archived":false,"fork":false,"pushed_at":"2025-02-28T19:04:34.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-28T22:54:01.064Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dflook.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"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},"funding":{"github":["dflook"]}},"created_at":"2023-10-23T17:01:37.000Z","updated_at":"2025-02-28T19:04:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"be2bc5e1-eae3-44e5-bcfd-77c9096c60e5","html_url":"https://github.com/dflook/tofu-fmt","commit_stats":null,"previous_names":["dflook/tofu-fmt"],"tags_count":54,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dflook%2Ftofu-fmt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dflook%2Ftofu-fmt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dflook%2Ftofu-fmt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dflook%2Ftofu-fmt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dflook","download_url":"https://codeload.github.com/dflook/tofu-fmt/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243695587,"owners_count":20332629,"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-11-21T04:29:21.724Z","updated_at":"2026-01-29T22:37:13.542Z","avatar_url":"https://github.com/dflook.png","language":null,"funding_links":["https://github.com/sponsors/dflook"],"categories":[],"sub_categories":[],"readme":"# tofu-fmt action\n\nThis is one of a suite of OpenTofu related actions - find them at [dflook/terraform-github-actions](https://github.com/dflook/terraform-github-actions).\n\nThis action uses the `tofu fmt -recursive` command to reformat files in a directory into a canonical format.\n\n## Inputs\n\n* `path`\n\n  The path containing OpenTofu files to format.\n\n  - Type: string\n  - Optional\n  - Default: The action workspace\n\n* `workspace`\n\n  OpenTofu workspace to inspect when discovering the OpenTofu version to use, if the version is not otherwise specified.\n  See [dflook/tofu-version](https://github.com/dflook/terraform-github-actions/tree/main/tofu-version#tofu-version-action) for details.\n\n  - Type: string\n  - Optional\n  - Default: `default`\n\n* `variables`\n\n  Variables to set when initializing OpenTofu. This should be valid OpenTofu syntax - like a [variable definition file](https://opentofu.org/docs/language/values/variables/#variable-definitions-tfvars-files).\n  Variables set here override any given in `var_file`s.\n\n  ```yaml\n  with:\n    variables: |\n      image_id = \"${{ secrets.AMI_ID }}\"\n      availability_zone_names = [\n        \"us-east-1a\",\n        \"us-west-1c\",\n      ]\n  ```\n\n  - Type: string\n  - Optional\n\n* `var_file`\n\n  List of tfvars files to use, one per line.\n  Paths should be relative to the GitHub Actions workspace\n\n  ```yaml\n  with:\n    var_file: |\n      common.tfvars\n      prod.tfvars\n  ```\n\n  - Type: string\n  - Optional\n\n* `backend_config`\n\n  List of OpenTofu backend config values, one per line. This is used for discovering the OpenTofu version to use, if the version is not otherwise specified.\n  See [dflook/tofu-version](https://github.com/dflook/terraform-github-actions/tree/main/tofu-version#tofu-version-action) for details.\n\n  ```yaml\n  with:\n    backend_config: token=${{ secrets.BACKEND_TOKEN }}\n  ```\n\n  - Type: string\n  - Optional\n\n* `backend_config_file`\n\n  List of OpenTofu backend config files to use, one per line. This is used for discovering the OpenTofu version to use, if the version is not otherwise specified.\n  See [dflook/tofu-version](https://github.com/dflook/terraform-github-actions/tree/main/tofu-version#tofu-version-action) for details.\n  Paths should be relative to the GitHub Actions workspace\n\n  ```yaml\n  with:\n    backend_config_file: prod.backend.tfvars\n  ```\n\n  - Type: string\n  - Optional\n\n## Environment Variables\n\n* `GITHUB_DOT_COM_TOKEN`\n\n  This is used to specify a token for GitHub.com when the action is running on a GitHub Enterprise instance.\n  This is only used for downloading OpenTofu binaries from GitHub.com.\n  If this is not set, an unauthenticated request will be made to GitHub.com to download the binary, which may be rate limited.\n\n  - Type: string\n  - Optional\n\n* `TERRAFORM_CLOUD_TOKENS`\n\n  For the purpose of detecting the OpenTofu version to use from a cloud backend.\n  API tokens for cloud hosts, of the form `\u003chost\u003e=\u003ctoken\u003e`. Multiple tokens may be specified, one per line.\n  These tokens may be used with the `remote` backend and for fetching required modules from the registry.\n\n  e.g:\n\n  ```yaml\n  env:\n    TERRAFORM_CLOUD_TOKENS: app.terraform.io=${{ secrets.TF_CLOUD_TOKEN }}\n  ```\n\n  With other registries:\n\n  ```yaml\n  env:\n    TERRAFORM_CLOUD_TOKENS: |\n      app.terraform.io=${{ secrets.TF_CLOUD_TOKEN }}\n      tofu.example.com=${{ secrets.TF_REGISTRY_TOKEN }}\n  ```\n\n  - Type: string\n  - Optional\n\n## Example usage\n\nThis example automatically creates a pull request to fix any formatting\nproblems that get merged into the main branch.\n\n```yaml\nname: Fix OpenTofu file formatting\n\non:\n  push:\n    branches:\n      - main\n\njobs:\n  format:\n    runs-on: ubuntu-latest\n    name: Check OpenTofu file are formatted correctly\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v4\n\n      - name: tofu fmt\n        uses: dflook/tofu-fmt@v2\n        with:\n          path: my-tofu-config\n\n      - name: Create Pull Request\n        uses: peter-evans/create-pull-request@v5\n        with:\n          commit-message: tofu fmt\n          title: Reformat tofu files\n          body: Update OpenTofu files to canonical format using `tofu fmt`\n          branch: automated-tofu-fmt\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdflook%2Ftofu-fmt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdflook%2Ftofu-fmt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdflook%2Ftofu-fmt/lists"}