{"id":15156473,"url":"https://github.com/devops-infra/action-terraform-copy-vars","last_synced_at":"2025-10-24T14:30:24.131Z","repository":{"id":39711415,"uuid":"254216596","full_name":"devops-infra/action-terraform-copy-vars","owner":"devops-infra","description":"GitHub Action automatically copying variables' definitions from a single file to many modules","archived":false,"fork":false,"pushed_at":"2025-02-03T01:32:53.000Z","size":138,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-05T17:06:22.665Z","etag":null,"topics":["action-terraform","automation","ci-cd","cicd","devops","devops-workflow","docker","dockerhub","github-action","github-action-docker","github-actions","github-actions-docker","iaac","terraform","terraform-modules","terragrunt"],"latest_commit_sha":null,"homepage":"https://christophshyper.github.io/","language":"Python","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-08T22:40:40.000Z","updated_at":"2025-01-30T17:06:09.000Z","dependencies_parsed_at":"2024-09-22T05:00:57.045Z","dependency_job_id":null,"html_url":"https://github.com/devops-infra/action-terraform-copy-vars","commit_stats":{"total_commits":79,"total_committers":4,"mean_commits":19.75,"dds":0.5696202531645569,"last_synced_commit":"b1c8a238827aa729bb9eb6e8a39776befc4482f6"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devops-infra%2Faction-terraform-copy-vars","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devops-infra%2Faction-terraform-copy-vars/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devops-infra%2Faction-terraform-copy-vars/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devops-infra%2Faction-terraform-copy-vars/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devops-infra","download_url":"https://codeload.github.com/devops-infra/action-terraform-copy-vars/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237981721,"owners_count":19397124,"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":["action-terraform","automation","ci-cd","cicd","devops","devops-workflow","docker","dockerhub","github-action","github-action-docker","github-actions","github-actions-docker","iaac","terraform","terraform-modules","terragrunt"],"created_at":"2024-09-26T19:21:53.981Z","updated_at":"2025-10-24T14:30:24.126Z","avatar_url":"https://github.com/devops-infra.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GitHub Action coping Terraform variables across modules\n**GitHub Action automatically copying variables' definitions from a single file to many modules.**\n\n\n## 📦 Available on\n- **Docker Hub:** [devopsinfra/action-terraform-copy-vars:latest](https://hub.docker.com/repository/docker/devopsinfra/action-terraform-copy-vars)\n- **GitHub Packages:** [ghcr.io/devops-infra/action-terraform-copy-vars:latest](https://github.com/orgs/devops-infra/packages/container/package/action-terraform-copy-vars)\n\n\n## ✨ Features\n* It's main use will be everywhere where [Terraform](https://github.com/hashicorp/terraform) is used with *more than one module in a **monorepo***.\n* Reads file defined with `all_vars_file` and will use whole definitions of variables from it.\n* For every module matching `dirs_with_modules` will search files matching `files_with_vars` and replace matching variables from `all_vars_file`.\n* To not loose the changes combine with my other action [devops-infra/action-commit-push](https://github.com/devops-infra/action-commit-push).\n\n\n## 🔗 Related Actions\n**Perfect for automation workflows and integrates seamlessly with [devops-infra/action-commit-push](https://github.com/devops-infra/action-commit-push).**\n\n\n## Badge swag\n[\n![GitHub repo](https://img.shields.io/badge/GitHub-devops--infra%2Faction--terraform--copy--vars-blueviolet.svg?style=plastic\u0026logo=github)\n![GitHub last commit](https://img.shields.io/github/last-commit/devops-infra/action-terraform-copy-vars?color=blueviolet\u0026logo=github\u0026style=plastic\u0026label=Last%20commit)\n![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/devops-infra/action-terraform-copy-vars?color=blueviolet\u0026label=Code%20size\u0026style=plastic\u0026logo=github)\n![GitHub license](https://img.shields.io/github/license/devops-infra/action-terraform-copy-vars?color=blueviolet\u0026logo=github\u0026style=plastic\u0026label=License)\n](https://github.com/devops-infra/action-terraform-copy-vars \"shields.io\")\n\u003cbr\u003e\n[\n![DockerHub](https://img.shields.io/badge/DockerHub-devopsinfra%2Faction--terraform--copy--vars-blue.svg?style=plastic\u0026logo=docker)\n![Docker version](https://img.shields.io/docker/v/devopsinfra/action-terraform-copy-vars?color=blue\u0026label=Version\u0026logo=docker\u0026style=plastic\u0026sort=semver)\n![Image size](https://img.shields.io/docker/image-size/devopsinfra/action-terraform-copy-vars/latest?label=Image%20size\u0026style=plastic\u0026logo=docker)\n![Docker Pulls](https://img.shields.io/docker/pulls/devopsinfra/action-terraform-copy-vars?color=blue\u0026label=Pulls\u0026logo=docker\u0026style=plastic)\n](https://hub.docker.com/r/devopsinfra/action-terraform-copy-vars \"shields.io\")\n\n\n## 🏷️ Version Tags: vX, vX.Y, vX.Y.Z\nThis action supports three tag levels for flexible versioning:\n- `vX`: latest patch of the major version (e.g., `v1`).\n- `vX.Y`: latest patch of the minor version (e.g., `v1.2`).\n- `vX.Y.Z`: fixed to a specific release (e.g., `v1.2.3`).\n\n\n## 📖 API Reference\n```yaml\n    - name: Run the action\n      uses: devops-infra/action-terraform-copy-vars@v1.0.0\n      with:\n        dirs_with_modules: modules\n        files_with_vars: variables.tf\n        all_vars_file: all-variables.tf\n        fail_on_missing: false\n```\n\n### 🔧 Input Parameters\n| Input Variable      | Required |      Default       | Description                                                                                     |\n|:--------------------|:--------:|:------------------:|:------------------------------------------------------------------------------------------------|\n| `dirs_with_modules` |    No    |    `terraform`     | Comma separated list of directory prefixes with modules.                                        |\n| `files_with_vars`   |    No    |   `variables.tf`   | Comma separated list of files containing variables in directories matching `dirs_with_modules`. |\n| `all_vars_file`     |    No    | `all-variables.tf` | Name of a file containing base definitions of all variables.                                    |\n| `fail_on_missing`   |    No    |      `false`       | Whether action should fail if `all_vars_file` is missing some definitions from modules.         |\n\n\n## 💻 Usage Examples\n\n### 📝 Basic Example\nFail action if not all variables in `variables.tf` in `terraform` subdirectories match their definitions in `all-variables.tf`.\n```yaml\nname: Check Terraform variables\non:\n  push\njobs:\n  terraform-copy-vars:\n    runs-on: ubuntu-latest\n    steps:\n    - name: Checkout repoistory\n      uses: actions/checkout@v5\n\n    - name: Fail on different variables' definitions\n      uses: devops-infra/action-terraform-copy-vars@v1.0.0\n      with:\n        fail_on_changes: true\n```\n\n### 🔀 Advanced Example\nCopy variables definitions from `all-variables.tf` to all `variables.tf` in `modules` subdirectories and commit updated files back to the repository using my other action [devops-infra/action-commit-push](https://github.com/devops-infra/action-commit-push).\n```yaml\nname: Copy Terraform variables accross modules\non:\n  push\njobs:\n  terraform-copy-vars:\n    runs-on: ubuntu-latest\n    steps:\n    - name: Checkout repoistory\n      uses: actions/checkout@v5\n\n    - name: Update Terraform variables\n      uses: devops-infra/action-terraform-copy-vars@v1.0.0\n      with:\n        dirs_with_modules: modules\n        files_with_vars: variables.tf\n        all_vars_file: all-variables.tf\n\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-VARIABLES]\"\n```\n\n\n## 🤝 Contributing\nContributions are welcome! See [CONTRIBUTING](https://github.com/devops-infra/.github/blob/master/CONTRIBUTING.md).\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n\n## 📄 License\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n\n## 💬 Support\nIf you have any questions or need help, please:\n- 📝 Create an [issue](https://github.com/devops-infra/action-terraform-copy-vars/issues)\n- 🌟 Star this repository if you find it useful!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevops-infra%2Faction-terraform-copy-vars","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevops-infra%2Faction-terraform-copy-vars","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevops-infra%2Faction-terraform-copy-vars/lists"}