|
| 1 | +name: Terraform Module CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main ] |
| 6 | + paths: |
| 7 | + - '**/*.tf' |
| 8 | + - '.tflint.hcl' |
| 9 | + - 'README.md' |
| 10 | + - 'LICENSE' |
| 11 | + pull_request: |
| 12 | + branches: [ main ] |
| 13 | + |
| 14 | +jobs: |
| 15 | + fmt-validate: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v4 |
| 19 | + - name: Setup Terraform |
| 20 | + uses: hashicorp/setup-terraform@v3 |
| 21 | + with: |
| 22 | + terraform_version: 1.7.5 |
| 23 | + - name: Terraform fmt (check) |
| 24 | + run: terraform fmt -check -recursive |
| 25 | + - name: Validate root module |
| 26 | + run: | |
| 27 | + terraform init -backend=false |
| 28 | + terraform validate |
| 29 | + - name: Validate metric-filter submodule |
| 30 | + run: | |
| 31 | + terraform -chdir=modules/metric-filter init -backend=false |
| 32 | + terraform -chdir=modules/metric-filter validate |
| 33 | + - name: Validate subscription-filter submodule |
| 34 | + run: | |
| 35 | + terraform -chdir=modules/subscription-filter init -backend=false |
| 36 | + terraform -chdir=modules/subscription-filter validate |
| 37 | + - name: Validate examples (metric) |
| 38 | + run: | |
| 39 | + terraform -chdir=examples/metric_filter_basic init -backend=false |
| 40 | + terraform -chdir=examples/metric_filter_basic validate |
| 41 | + - name: Validate examples (subscription) |
| 42 | + run: | |
| 43 | + terraform -chdir=examples/subscription_filter_basic init -backend=false |
| 44 | + terraform -chdir=examples/subscription_filter_basic validate |
| 45 | +
|
| 46 | + tflint: |
| 47 | + runs-on: ubuntu-latest |
| 48 | + steps: |
| 49 | + - uses: actions/checkout@v4 |
| 50 | + - name: Setup TFLint |
| 51 | + uses: terraform-linters/setup-tflint@v4 |
| 52 | + - name: TFLint init |
| 53 | + run: tflint --init || true |
| 54 | + - name: TFLint root |
| 55 | + run: tflint -c .tflint.hcl . |
| 56 | + - name: TFLint metric-filter module |
| 57 | + run: tflint -c .tflint.hcl modules/metric-filter |
| 58 | + - name: TFLint subscription-filter module |
| 59 | + run: tflint -c .tflint.hcl modules/subscription-filter |
| 60 | + - name: TFLint examples (metric) |
| 61 | + run: tflint -c .tflint.hcl examples/metric_filter_basic |
| 62 | + - name: TFLint examples (subscription) |
| 63 | + run: tflint -c .tflint.hcl examples/subscription_filter_basic |
| 64 | + |
0 commit comments