File tree Expand file tree Collapse file tree 6 files changed +73
-4
lines changed
Expand file tree Collapse file tree 6 files changed +73
-4
lines changed Original file line number Diff line number Diff line change 1414jobs :
1515 fmt-validate :
1616 runs-on : ubuntu-latest
17+ env :
18+ TF_PLUGIN_CACHE_DIR : ${{ runner.temp }}/tf-plugin-cache
1719 steps :
1820 - uses : actions/checkout@v4
21+ - name : Create plugin cache
22+ run : mkdir -p "$TF_PLUGIN_CACHE_DIR"
1923 - name : Setup Terraform
2024 uses : hashicorp/setup-terraform@v3
2125 with :
4549
4650 tflint :
4751 runs-on : ubuntu-latest
52+ env :
53+ TF_PLUGIN_CACHE_DIR : ${{ runner.temp }}/tf-plugin-cache
4854 steps :
4955 - uses : actions/checkout@v4
56+ - name : Create plugin cache
57+ run : mkdir -p "$TF_PLUGIN_CACHE_DIR"
5058 - name : Setup TFLint
5159 uses : terraform-linters/setup-tflint@v4
5260 - name : TFLint init
Original file line number Diff line number Diff line change 11# Terraform local artifacts
22** /.terraform /
33** /.terraform.lock.hcl
4+ /.terraform.d /
45* .tfstate
56* .tfstate.backup
67
Original file line number Diff line number Diff line change 1+ SHELL := /bin/bash
2+
3+ export TF_PLUGIN_CACHE_DIR ?= $(CURDIR ) /.terraform.d/plugin-cache
4+
5+ DIRS := . \
6+ modules/metric-filter \
7+ modules/subscription-filter \
8+ examples/metric_filter_basic \
9+ examples/subscription_filter_basic
10+
11+ .PHONY : validate fmt lint _init_validate ensure-cache
12+
13+ validate : ensure-cache fmt # # Format, init (cached), and validate all modules/examples
14+ @echo " Using TF_PLUGIN_CACHE_DIR=$( TF_PLUGIN_CACHE_DIR) "
15+ @$(MAKE ) _init_validate
16+
17+ ensure-cache :
18+ @mkdir -p " $( TF_PLUGIN_CACHE_DIR) "
19+
20+ _init_validate :
21+ @set -euo pipefail; \
22+ for d in $( DIRS) ; do \
23+ echo " ==> $$ d" ; \
24+ terraform -chdir=$$ d init -backend=false -upgrade=false > /dev/null; \
25+ terraform -chdir=$$ d validate; \
26+ done
27+
28+ fmt : # # Run terraform fmt -check -recursive
29+ @terraform fmt -check -recursive
30+
31+ lint : # # Run TFLint across repo, modules, and examples
32+ @tflint --init || true
33+ @tflint -c .tflint.hcl .
34+ @tflint --chdir modules/metric-filter -c ../../.tflint.hcl
35+ @tflint --chdir modules/subscription-filter -c ../../.tflint.hcl
36+ @tflint --chdir examples/metric_filter_basic -c ../../.tflint.hcl
37+ @tflint --chdir examples/subscription_filter_basic -c ../../.tflint.hcl
38+
39+ help : # # Show help
40+ @grep -E ' ^[a-zA-Z_-]+:.*?## ' $(MAKEFILE_LIST ) | awk ' BEGIN {FS=":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
Original file line number Diff line number Diff line change @@ -3,12 +3,11 @@ terraform {
33 required_providers {
44 logstruct = {
55 source = " DocSpring/logstruct"
6- version = " >= 0.0.4 "
6+ version = " >= 0.0.6 "
77 }
88 aws = {
99 source = " hashicorp/aws"
1010 version = " >= 5.0"
1111 }
1212 }
1313}
14-
Original file line number Diff line number Diff line change @@ -3,12 +3,11 @@ terraform {
33 required_providers {
44 logstruct = {
55 source = " DocSpring/logstruct"
6- version = " >= 0.0.4 "
6+ version = " >= 0.0.6 "
77 }
88 aws = {
99 source = " hashicorp/aws"
1010 version = " >= 5.0"
1111 }
1212 }
1313}
14-
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ set -euo pipefail
3+
4+ # Usage: VERSION=0.0.6 bash scripts/sync_provider_version.sh
5+ VERSION=" ${VERSION:- } "
6+ if [[ -z " $VERSION " ]]; then
7+ echo " Usage: VERSION=X.Y.Z $0 " >&2
8+ exit 1
9+ fi
10+
11+ update_file () {
12+ local file=" $1 "
13+ if [[ -f " $file " ]]; then
14+ sed -i.bak -E " s|(source\s*=\s*\" DocSpring/logstruct\" [\s\S]*version\s*=\s*\" )>=?\s*[0-9.]+\" |\1>= $VERSION \" |" " $file " && rm -f " $file .bak"
15+ fi
16+ }
17+
18+ update_file modules/metric-filter/versions.tf
19+ update_file modules/subscription-filter/versions.tf
20+
21+ echo " Synchronized provider constraints to >= $VERSION "
22+
You can’t perform that action at this time.
0 commit comments