Compare commits

...

9 commits

Author SHA1 Message Date
kvendingoldo
213d3c78c0
Merge pull request #85 from Montana/docs/fix-readme-anchor-links
docs: Fix broken anchor links in README (mostly terraform)
2026-07-08 20:03:51 +04:00
you
c2f6c57a25 docs: fix broken anchor links in README
Signed-off-by: Montana <montana@linux.com>
2026-07-07 10:29:34 -07:00
kvendingoldo
80fc83806e
Merge pull request #82 from Nmishin/fix/maintained
feat: Update maintained status
2026-06-20 12:58:24 +04:00
kvendingoldo
57ef1d870c
Merge pull request #81 from Nmishin/fix/disable_cron
feat: Remove build and push nightly schedule
2026-06-20 12:57:53 +04:00
Nikolai Mishin
577e9ca85d
feat: Update maintained status
Signed-off-by: Nikolai Mishin <sanduku.default@gmail.com>
2026-06-20 00:18:38 +02:00
Nikolai Mishin
5fed19ce02
feat: Remove build and push nightly schedule
Signed-off-by: Nikolai Mishin <sanduku.default@gmail.com>
2026-06-20 00:15:08 +02:00
semantic-release-bot
c43835bd4b chore(release): version 2.4.2 [skip ci]
## [2.4.2](https://github.com/tofuutils/pre-commit-opentofu/compare/v2.4.1...v2.4.2) (2026-06-12)

### Bug Fixes

* **hooks:** make env var regex portable ([caab3b8](caab3b8701))
2026-06-12 22:00:23 +00:00
kvendingoldo
cc0381b3f8
Merge pull request #79 from RoseSecurity/fix-bash-incompatibility-errors
fix(hooks): Make env var regex portable
2026-06-13 01:59:48 +04:00
Michael Rosenfeld
caab3b8701
fix(hooks): make env var regex portable
Adjust the regex used to detect ${ENV_VAR} patterns in
hooks/_common.sh to avoid Bash-incompatible constructs and to be
compatible with macOS/BSD regex behavior.

- Remove unnecessary leading/trailing '.*' since =~ matches substrings.
- Allow lowercase letters in subsequent identifier characters
  ([A-Za-z0-9_]) so variable names with lowercase chars are detected.
- Keep first-char restriction to uppercase or underscore to match
  existing extraction logic.

Signed-off-by: Michael Rosenfeld <mrosenfe@sheetz.com>
2026-06-12 15:26:10 -04:00
4 changed files with 19 additions and 45 deletions

View file

@ -5,8 +5,6 @@ on:
release:
types:
- created
schedule:
- cron: '00 00 * * *'
jobs:
docker:
@ -33,7 +31,6 @@ jobs:
echo IMAGE_TAG=$([ ${{ github.ref_type }} == 'tag' ] && echo ${{ github.ref_name }} || echo 'latest') >> $GITHUB_ENV
- name: Build and Push release to ghcr.io
if: github.event_name != 'schedule'
uses: docker/build-push-action@v5
with:
context: .
@ -49,22 +46,6 @@ jobs:
secrets: |
"github_token=${{ secrets.GITHUB_TOKEN }}"
- name: Build and Push nightly to ghcr.io
if: github.event_name == 'schedule'
uses: docker/build-push-action@v5
with:
context: .
build-args: |
INSTALL_ALL=true
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/${{ github.repository }}:nightly
# Fix multi-platform: https://github.com/docker/buildx/issues/1533
provenance: false
secrets: |
"github_token=${{ secrets.GITHUB_TOKEN }}"
- name: Login to DockerHub Container Registry
uses: docker/login-action@v4
with:
@ -73,7 +54,6 @@ jobs:
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and Push release to DockerHub
if: github.event_name != 'schedule'
uses: docker/build-push-action@v5
with:
context: .
@ -85,16 +65,3 @@ jobs:
registry.hub.docker.com/tofuutils/pre-commit-opentofu:${{ env.IMAGE_TAG }}
registry.hub.docker.com/tofuutils/pre-commit-opentofu:latest
provenance: false
- name: Build and Push nightly to DockerHub
if: github.event_name == 'schedule'
uses: docker/build-push-action@v5
with:
context: .
build-args: |
INSTALL_ALL=true
platforms: linux/amd64,linux/arm64
push: true
tags: |
registry.hub.docker.com/tofuutils/pre-commit-opentofu:nightly
provenance: false

View file

@ -2,6 +2,13 @@
All notable changes to this project will be documented in this file.
## [2.4.2](https://github.com/tofuutils/pre-commit-opentofu/compare/v2.4.1...v2.4.2) (2026-06-12)
### Bug Fixes
* **hooks:** make env var regex portable ([caab3b8](https://github.com/tofuutils/pre-commit-opentofu/commit/caab3b8701405a446489a7864f91a2c9f281eee0))
## [2.4.1](https://github.com/tofuutils/pre-commit-opentofu/compare/v2.4.0...v2.4.1) (2026-06-01)

View file

@ -1,6 +1,6 @@
# Collection of git hooks for OpenTofu to be used with [pre-commit framework](http://pre-commit.com/)
[![Github tag](https://img.shields.io/github/tag/tofuutils/pre-commit-opentofu.svg)](https://github.com/tofuutils/pre-commit-opentofu/releases) ![maintenance status](https://img.shields.io/maintenance/yes/2024.svg) [![Help Contribute to Open Source](https://www.codetriage.com/tofuutils/pre-commit-opentofu/badges/users.svg)](https://www.codetriage.com/tofuutils/pre-commit-opentofu)
[![Github tag](https://img.shields.io/github/tag/tofuutils/pre-commit-opentofu.svg)](https://github.com/tofuutils/pre-commit-opentofu/releases) ![maintenance status](https://img.shields.io/maintenance/yes/2026.svg) [![Help Contribute to Open Source](https://www.codetriage.com/tofuutils/pre-commit-opentofu/badges/users.svg)](https://www.codetriage.com/tofuutils/pre-commit-opentofu)
Want to contribute? Check [open issues](https://github.com/tofuutils/pre-commit-opentofu/issues?q=label%3A%22good+first+issue%22+is%3Aopen+sort%3Aupdated-desc) and [contributing notes](/.github/CONTRIBUTING.md).
@ -37,7 +37,7 @@ If you are using `pre-commit-opentofu` already or want to support its developmen
* [tfupdate](#tfupdate)
* [Docker Usage](#docker-usage)
* [File Permissions](#file-permissions)
* [Download OpenTofu modules from private GitHub repositories](#download-tofu-modules-from-private-github-repositories)
* [Download OpenTofu modules from private GitHub repositories](#download-opentofu-modules-from-private-github-repositories)
* [Authors](#authors)
* [License](#license)
@ -301,19 +301,19 @@ There are several [pre-commit](https://pre-commit.com/) hooks to keep OpenTofu c
| ------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------ |
| `checkov` and `tofu_checkov` | [checkov](https://github.com/bridgecrewio/checkov) static analysis of OpenTofu templates to spot potential security issues. [Hook notes](#checkov-deprecated-and-tofu_checkov) | `checkov`<br>Ubuntu deps: `python3`, `python3-pip` |
| `infracost_breakdown` | Check how much your infra costs with [infracost](https://github.com/infracost/infracost). [Hook notes](#infracost_breakdown) | `infracost`, `jq`, [Infracost API key](https://www.infracost.io/docs/#2-get-api-key) |
| `tofu_docs` | Inserts input and output documentation into `README.md`. Recommended. [Hook notes](#terraform_docs) | `terraform-docs` |
| `tofu_docs_replace` | Runs `terraform-docs` and pipes the output directly to README.md. **DEPRECATED**. [Hook notes](#terraform_docs_replace-deprecated) | `python3`, `terraform-docs` |
| `tofu_docs_without_`<br>`aggregate_type_defaults` | Inserts input and output documentation into `README.md` without aggregate type defaults. Hook notes same as for [tofu_docs](#terraform_docs) | `tofu-docs` |
| `tofu_fmt` | Reformat all OpenTofu configuration files to a canonical format. [Hook notes](#terraform_fmt) | - |
| `tofu_providers_lock` | Updates provider signatures in [dependency lock files](https://www.terraform.io/docs/cli/commands/providers/lock.html). [Hook notes](#terraform_providers_lock) | - |
| `tofu_tflint` | Validates all OpenTofu configuration files with [TFLint](https://github.com/terraform-linters/tflint). [Available TFLint rules](https://github.com/terraform-linters/tflint/tree/master/docs/rules#rules). [Hook notes](#terraform_tflint). | `tflint` |
| `tofu_tfsec` | [TFSec](https://github.com/aquasecurity/tfsec) static analysis of terraform templates to spot potential security issues. **DEPRECATED**, use `tofu_trivy`. [Hook notes](#terraform_tfsec-deprecated) | `tfsec` |
| `tofu_trivy` | [Trivy](https://github.com/aquasecurity/trivy) static analysis of terraform templates to spot potential security issues. [Hook notes](#terraform_trivy) | `trivy` |
| `tofu_docs` | Inserts input and output documentation into `README.md`. Recommended. [Hook notes](#tofu_docs) | `terraform-docs` |
| `tofu_docs_replace` | Runs `terraform-docs` and pipes the output directly to README.md. **DEPRECATED**. [Hook notes](#tofu_docs_replace-deprecated) | `python3`, `terraform-docs` |
| `tofu_docs_without_`<br>`aggregate_type_defaults` | Inserts input and output documentation into `README.md` without aggregate type defaults. Hook notes same as for [tofu_docs](#tofu_docs) | `tofu-docs` |
| `tofu_fmt` | Reformat all OpenTofu configuration files to a canonical format. [Hook notes](#tofu_fmt) | - |
| `tofu_providers_lock` | Updates provider signatures in [dependency lock files](https://www.terraform.io/docs/cli/commands/providers/lock.html). [Hook notes](#tofu_providers_lock) | - |
| `tofu_tflint` | Validates all OpenTofu configuration files with [TFLint](https://github.com/terraform-linters/tflint). [Available TFLint rules](https://github.com/terraform-linters/tflint/tree/master/docs/rules#rules). [Hook notes](#tofu_tflint). | `tflint` |
| `tofu_tfsec` | [TFSec](https://github.com/aquasecurity/tfsec) static analysis of terraform templates to spot potential security issues. **DEPRECATED**, use `tofu_trivy`. [Hook notes](#tofu_tfsec-deprecated) | `tfsec` |
| `tofu_trivy` | [Trivy](https://github.com/aquasecurity/trivy) static analysis of terraform templates to spot potential security issues. [Hook notes](#tofu_trivy) | `trivy` |
| `tofu_validate` | Validates all Terraform configuration files. [Hook notes](#tofu_validate) | `jq`, only for `--retry-once-with-cleanup` flag |
| `terragrunt_fmt` | Reformat all [Terragrunt](https://github.com/gruntwork-io/terragrunt) configuration files (`*.hcl`) to a canonical format. | `terragrunt` |
| `terragrunt_validate` | Validates all [Terragrunt](https://github.com/gruntwork-io/terragrunt) configuration files (`*.hcl`) | `terragrunt` |
| `terragrunt_validate_inputs` | Validates Terragrunt unused and undefined inputs. | `terragrunt` |
| `tofu_wrapper_module_for_each` | Generates OpenTofu wrappers with `for_each` in module. [Hook notes](#terraform_wrapper_module_for_each) | `hcledit` |
| `tofu_wrapper_module_for_each` | Generates OpenTofu wrappers with `for_each` in module. [Hook notes](#tofu_wrapper_module_for_each) | `hcledit` |
| `terrascan` | [terrascan](https://github.com/tenable/terrascan) Detect compliance and security violations. [Hook notes](#terrascan) | `terrascan` |
| `tfupdate` | [tfupdate](https://github.com/minamijoyo/tfupdate) Update version constraints of OpenTofu core, providers, and modules. [Hook notes](#tfupdate) | `tfupdate` |
<!-- markdownlint-enable no-inline-html -->

View file

@ -112,7 +112,7 @@ function common::parse_and_export_env_vars {
while true; do
# Check if at least 1 env var exists in `$arg`
# shellcheck disable=SC2016 # '${' should not be expanded
if [[ "$arg" =~ .*'${'[A-Z_][A-Z0-9_]*'}'.* ]]; then
if [[ "$arg" =~ '${'[A-Z_][A-Za-z0-9_]*'}' ]]; then
# Get `ENV_VAR` from `.*${ENV_VAR}.*`
local env_var_name=${arg#*$\{}
env_var_name=${env_var_name%%\}*}