-
-
Notifications
You must be signed in to change notification settings - Fork 2
108 lines (90 loc) · 3.14 KB
/
terraform.integration.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: Integration (Terraform)
on:
push:
branches:
- main
pull_request: {}
concurrency:
group: terraform-integration-${{ github.ref }}
cancel-in-progress: true
jobs:
changed:
name: Filter Changed Files and Directories
runs-on: ubuntu-latest
outputs:
changed: ${{ steps.set-outputs.outputs.changed }}
modified: ${{ steps.set-outputs.outputs.modified }}
changed_files: ${{ steps.set-outputs.outputs.changed_files }}
modified_files: ${{ steps.set-outputs.outputs.modified_files }}
changed_directories: ${{ steps.set-outputs.outputs.changed_directories }}
modified_directories: ${{ steps.set-outputs.outputs.modified_directories }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get Changed Files
id: changed-files
uses: tj-actions/changed-files@v40
with:
files: |
modules/**
examples/**
json: true
- name: Get Changed Directories
id: changed-directories
uses: tj-actions/changed-files@v40
with:
files: |
modules/**
examples/**
dir_names: "true"
dir_names_max_depth: 2
json: true
- name: Set outputs
id: set-outputs
run: |
echo "changed=${{ steps.changed-directories.outputs.any_changed }}" >> $GITHUB_OUTPUT
echo "modified=${{ steps.changed-directories.outputs.any_modified }}" >> $GITHUB_OUTPUT
echo "changed_files=${{ steps.changed-files.outputs.all_changed_files }}" >> $GITHUB_OUTPUT
echo "modified_files=${{ steps.changed-files.outputs.all_modified_files }}" >> $GITHUB_OUTPUT
echo "changed_directories=${{ steps.changed-directories.outputs.all_changed_files }}" >> $GITHUB_OUTPUT
echo "modified_directories=${{ steps.changed-directories.outputs.all_modified_files }}" >> $GITHUB_OUTPUT
terraform:
name: Lint (terraform)
needs:
- changed
if: ${{ needs.changed.outputs.modified == 'true' }}
uses: tedilabs/.github/.github/workflows/terraform.terraform.yaml@main
strategy:
matrix:
path: ${{ fromJson(needs.changed.outputs.modified_directories) }}
with:
terraform_target_dir: ${{ matrix.path }}
terraform_version: latest
terraform_host: app.terraform.io
secrets:
gh_token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
terraform_token: ${{ secrets.TERRAFORM_TOKEN }}
tflint:
name: Lint (tflint)
needs:
- changed
if: ${{ needs.changed.outputs.modified == 'true' }}
uses: tedilabs/.github/.github/workflows/terraform.tflint.yaml@main
strategy:
matrix:
path: ${{ fromJson(needs.changed.outputs.modified_directories) }}
with:
tflint_version: latest
tflint_config_file: .tflint.hcl
tflint_target_dir: ${{ matrix.path }}
tflint_recursive_enabled: false
tflint_terraform_init_enabled: true
terraform_version: latest
terraform_host: app.terraform.io
secrets:
gh_token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
terraform_token: ${{ secrets.TERRAFORM_TOKEN }}