{"id":21495998,"url":"https://github.com/devops-infra/action-format-hcl","last_synced_at":"2025-07-15T19:32:11.523Z","repository":{"id":39711268,"uuid":"252788447","full_name":"devops-infra/action-format-hcl","owner":"devops-infra","description":"GitHub Action automatically formatting all HCL and TF files","archived":false,"fork":false,"pushed_at":"2024-11-18T18:51:13.000Z","size":187,"stargazers_count":9,"open_issues_count":7,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-18T19:46:02.283Z","etag":null,"topics":["automation","christophshyper","ci-cd","cicd","devops","devops-workflow","docker","dockerhub","github-action","github-action-docker","github-actions","github-actions-docker","hcl","hcl-files","hcl2","hclfmt","iaac","terraform","terragrunt"],"latest_commit_sha":null,"homepage":"https://christophshyper.github.io/","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devops-infra.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-03T16:48:04.000Z","updated_at":"2024-11-06T12:53:47.000Z","dependencies_parsed_at":"2024-10-29T08:24:58.309Z","dependency_job_id":"7fb3bdff-94e9-4870-b50d-e1da8b233610","html_url":"https://github.com/devops-infra/action-format-hcl","commit_stats":{"total_commits":93,"total_committers":5,"mean_commits":18.6,"dds":0.4408602150537635,"last_synced_commit":"5863cfa21c1e260cfd5d17ff43fca112490fa70a"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devops-infra%2Faction-format-hcl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devops-infra%2Faction-format-hcl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devops-infra%2Faction-format-hcl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devops-infra%2Faction-format-hcl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devops-infra","download_url":"https://codeload.github.com/devops-infra/action-format-hcl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226064520,"owners_count":17568036,"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":["automation","christophshyper","ci-cd","cicd","devops","devops-workflow","docker","dockerhub","github-action","github-action-docker","github-actions","github-actions-docker","hcl","hcl-files","hcl2","hclfmt","iaac","terraform","terragrunt"],"created_at":"2024-11-23T16:14:25.283Z","updated_at":"2025-07-15T19:32:11.511Z","avatar_url":"https://github.com/devops-infra.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GitHub Action for formating HCL files\n\n**GitHub Action automatically formatting all [HCL](https://github.com/hashicorp/hcl) and [TF](https://www.terraform.io/docs/configuration/index.html) files (.hcl, .tf, .tfvars).**\n\nDockerized as [devopsinfra/action-format-hcl](https://hub.docker.com/repository/docker/devopsinfra/action-format-hcl). \n\nFeatures:\n* Container is a stripped down image of my other creation - [devopsinfra/docker-terragrunt](https://github.com/devopsinfra/docker-terragrunt) - framework for managing Infrastructure-as-a-Code.\n* Main use will be everywhere where [Terraform](https://github.com/hashicorp/terraform) or [Terragrunt](https://github.com/gruntwork-io/terragrunt) is used.\n* Using combination of my wrapper for [cytopia](https://github.com/cytopia)'s [docker-terragrunt-fmt](https://github.com/cytopia/docker-terragrunt-fmt).\n\n\n## Badge swag\n[![Master branch](https://github.com/devops-infra/action-format-hcl/workflows/Master%20branch/badge.svg)](https://github.com/devops-infra/action-format-hcl/actions?query=workflow%3A%22Master+branch%22)\n[![Other branches](https://github.com/devops-infra/action-format-hcl/workflows/Other%20branches/badge.svg)](https://github.com/devops-infra/action-format-hcl/actions?query=workflow%3A%22Other+branches%22)\n\u003cbr\u003e\n[\n![GitHub repo](https://img.shields.io/badge/GitHub-devops--infra%2Faction--format--hcl-blueviolet.svg?style=plastic\u0026logo=github)\n![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/devops-infra/action-format-hcl?color=blueviolet\u0026label=Code%20size\u0026style=plastic\u0026logo=github)\n![GitHub last commit](https://img.shields.io/github/last-commit/devops-infra/action-format-hcl?color=blueviolet\u0026logo=github\u0026style=plastic\u0026label=Last%20commit)\n![GitHub license](https://img.shields.io/github/license/devops-infra/action-format-hcl?color=blueviolet\u0026logo=github\u0026style=plastic\u0026label=License)\n](https://github.com/devops-infra/action-format-hcl \"shields.io\")\n\u003cbr\u003e\n[\n![DockerHub](https://img.shields.io/badge/DockerHub-devopsinfra%2Faction--format--hcl-blue.svg?style=plastic\u0026logo=docker)\n![Docker version](https://img.shields.io/docker/v/devopsinfra/action-format-hcl?color=blue\u0026label=Version\u0026logo=docker\u0026style=plastic)\n![Image size](https://img.shields.io/docker/image-size/devopsinfra/action-format-hcl/latest?label=Image%20size\u0026style=plastic\u0026logo=docker)\n![Docker Pulls](https://img.shields.io/docker/pulls/devopsinfra/action-format-hcl?color=blue\u0026label=Pulls\u0026logo=docker\u0026style=plastic)\n](https://hub.docker.com/r/devopsinfra/action-format-hcl \"shields.io\")\n\n\n## Reference\n\n```yaml\n    - name: Fail on malformatted files\n      uses: devops-infra/action-format-hcl@v0.3.6\n      with:\n        list: false\n        write: true\n        ignore: \"config\"\n        diff: false\n        check: false\n        recursive: true\n        dir: \"modules\"\n```\n\n| Input Variable | Required | Default | Description                                                   |\n| -------------- | -------- | ------- |---------------------------------------------------------------|\n| list           | No       | `false` | List files containing formatting inconsistencies.             |\n| write          | No       | `true`  | Overwrite input files. Should be disabled if using check.     |\n| ignore         | No       | `\"\"`    | Comma separated list of paths to ignore. Only for .hcl files. |\n| diff           | No       | `false` | Display diffs of formatting changes.                          |\n| check          | No       | `false` | Check if files are malformatted.                              |\n| recursive      | No       | `true`  | Also process files in subdirectories.                         |\n| dir            | No       | `\"\"`    | Path to be checked. Current dir as default.                   |\n\n\n## Examples\n\nAction can fail if malformed files will be found.\n```yaml\nname: Check HCL\non:\n  push\njobs:\n  format-hcl:\n    runs-on: ubuntu-latest\n    steps:\n    - name: Checkout\n      uses: actions/checkout@v2\n    - name: Fail on malformatted files\n      uses: devops-infra/action-format-hcl@v0.3.6\n      with:\n        check: true\n```\n\nAction can automatically format all HCL files and commit updated files back to the repository using my other action [action-commit-push](https://github.com/devops-infra/action-commit-push).\n```yaml\nname: Format HCL\non:\n  push\njobs:\n  format-hcl:\n    runs-on: ubuntu-latest\n    steps:\n    - name: Checkout\n      uses: actions/checkout@v2\n    - name: Format HCL files\n      uses: devops-infra/action-format-hcl@v0.3.6\n    - name: Commit changes to repo\n      uses: devops-infra/action-commit-push@master\n      with:\n        github_token: ${{ secrets.GITHUB_TOKEN }}\n        commit_prefix: \"[AUTO-FORMAT-HCL]\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevops-infra%2Faction-format-hcl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevops-infra%2Faction-format-hcl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevops-infra%2Faction-format-hcl/lists"}