{"id":21261398,"url":"https://github.com/dflook/terraform-fmt","last_synced_at":"2025-07-11T03:31:29.042Z","repository":{"id":61301417,"uuid":"277396362","full_name":"dflook/terraform-fmt","owner":"dflook","description":"GitHub action to fix formatting of terraform files","archived":false,"fork":false,"pushed_at":"2024-05-28T19:56:28.000Z","size":39,"stargazers_count":15,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-05-29T10:47:50.510Z","etag":null,"topics":["actions","devops","github-action","github-actions","terraform"],"latest_commit_sha":null,"homepage":"","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":"2020-07-05T22:52:40.000Z","updated_at":"2024-08-06T04:06:56.553Z","dependencies_parsed_at":"2023-02-18T01:31:16.925Z","dependency_job_id":"77d32bcb-c51c-4bc9-b21b-aabb4969a4ed","html_url":"https://github.com/dflook/terraform-fmt","commit_stats":{"total_commits":57,"total_committers":1,"mean_commits":57.0,"dds":0.0,"last_synced_commit":"ef0864bf49d7cff2b35f085846c8d24c2b9d2437"},"previous_names":[],"tags_count":149,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dflook%2Fterraform-fmt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dflook%2Fterraform-fmt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dflook%2Fterraform-fmt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dflook%2Fterraform-fmt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dflook","download_url":"https://codeload.github.com/dflook/terraform-fmt/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225675050,"owners_count":17506269,"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":["actions","devops","github-action","github-actions","terraform"],"created_at":"2024-11-21T04:29:25.291Z","updated_at":"2025-07-11T03:31:29.036Z","avatar_url":"https://github.com/dflook.png","language":null,"funding_links":["https://github.com/sponsors/dflook"],"categories":[],"sub_categories":[],"readme":"# terraform-fmt action\n\nThis is one of a suite of Terraform related actions - find them at [dflook/terraform-github-actions](https://github.com/dflook/terraform-github-actions).\n\nThis action uses the `terraform fmt -recursive` command to reformat files in a directory into a canonical format.\n\n## Inputs\n\n* `path`\n\n  The path containing Terraform files to format.\n\n  - Type: string\n  - Optional\n  - Default: The action workspace\n\n* `workspace`\n\n  Terraform workspace to inspect when discovering the Terraform version to use, if the version is not otherwise specified.\n  See [dflook/terraform-version](https://github.com/dflook/terraform-github-actions/tree/main/terraform-version#terraform-version-action) for details.\n\n  - Type: string\n  - Optional\n  - Default: `default`\n\n* `backend_config`\n\n  List of Terraform backend config values, one per line. This is used for discovering the Terraform version to use, if the version is not otherwise specified.\n  See [dflook/terraform-version](https://github.com/dflook/terraform-github-actions/tree/main/terraform-version#terraform-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 Terraform backend config files to use, one per line. This is used for discovering the Terraform version to use, if the version is not otherwise specified.\n  See [dflook/terraform-version](https://github.com/dflook/terraform-github-actions/tree/main/terraform-version#terraform-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 Terraform 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      terraform.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 Terraform file formatting\n\non:\n  push:\n    branches:\n      - main\n\njobs:\n  format:\n    runs-on: ubuntu-latest\n    name: Check Terraform file are formatted correctly\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v4\n\n      - name: terraform fmt\n        uses: dflook/terraform-fmt@v2\n        with:\n          path: my-terraform-config\n\n      - name: Create Pull Request\n        uses: peter-evans/create-pull-request@v5\n        with:\n          commit-message: terraform fmt\n          title: Reformat terraform files\n          body: Update Terraform files to canonical format using `terraform fmt`\n          branch: automated-terraform-fmt\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdflook%2Fterraform-fmt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdflook%2Fterraform-fmt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdflook%2Fterraform-fmt/lists"}