Skip to content

Commit 168e75f

Browse files
Add GitHub workflows and update Terraform and tf-docs version (#32)
1 parent a52fd43 commit 168e75f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+479
-68
lines changed

.github/workflows/dynamic-readme.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: update-templates
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
jobs:
10+
update-templates:
11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
pages: write
15+
uses: thoughtbot/templates/.github/workflows/dynamic-readme.yaml@main
16+
secrets:
17+
token: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: elasticache-redis/auth-token
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
paths:
7+
- elasticache-redis/auth-token/**
8+
types:
9+
- closed
10+
- opened
11+
- reopened
12+
- synchronize
13+
jobs:
14+
terraform:
15+
uses: ./.github/workflows/terraform.yml
16+
concurrency: ${{ github.workflow }}
17+
with:
18+
module: elasticache-redis/auth-token
19+
permissions:
20+
id-token: write
21+
contents: write
22+
checks: write
23+
pull-requests: write
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: elasticache-redis/replication-group
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
paths:
7+
- elasticache-redis/replication-group/**
8+
types:
9+
- closed
10+
- opened
11+
- reopened
12+
- synchronize
13+
jobs:
14+
terraform:
15+
uses: ./.github/workflows/terraform.yml
16+
concurrency: ${{ github.workflow }}
17+
with:
18+
module: elasticache-redis/replication-group
19+
permissions:
20+
id-token: write
21+
contents: write
22+
checks: write
23+
pull-requests: write

.github/workflows/kafka.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: kafka
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
paths:
7+
- kafka/**
8+
types:
9+
- closed
10+
- opened
11+
- reopened
12+
- synchronize
13+
jobs:
14+
terraform:
15+
uses: ./.github/workflows/terraform.yml
16+
concurrency: ${{ github.workflow }}
17+
with:
18+
module: kafka
19+
permissions:
20+
id-token: write
21+
contents: write
22+
checks: write
23+
pull-requests: write
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: rds-postgres/admin-login
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
paths:
7+
- rds-postgres/admin-login/**
8+
types:
9+
- closed
10+
- opened
11+
- reopened
12+
- synchronize
13+
jobs:
14+
terraform:
15+
uses: ./.github/workflows/terraform.yml
16+
concurrency: ${{ github.workflow }}
17+
with:
18+
module: rds-postgres/admin-login
19+
permissions:
20+
id-token: write
21+
contents: write
22+
checks: write
23+
pull-requests: write
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: rds-postgres/cloudwatch-alarms
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
paths:
7+
- rds-postgres/cloudwatch-alarms/**
8+
types:
9+
- closed
10+
- opened
11+
- reopened
12+
- synchronize
13+
jobs:
14+
terraform:
15+
uses: ./.github/workflows/terraform.yml
16+
concurrency: ${{ github.workflow }}
17+
with:
18+
module: rds-postgres/cloudwatch-alarms
19+
permissions:
20+
id-token: write
21+
contents: write
22+
checks: write
23+
pull-requests: write
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: rds-postgres/parameter-group
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
paths:
7+
- rds-postgres/parameter-group/**
8+
types:
9+
- closed
10+
- opened
11+
- reopened
12+
- synchronize
13+
jobs:
14+
terraform:
15+
uses: ./.github/workflows/terraform.yml
16+
concurrency: ${{ github.workflow }}
17+
with:
18+
module: rds-postgres/parameter-group
19+
permissions:
20+
id-token: write
21+
contents: write
22+
checks: write
23+
pull-requests: write
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: rds-postgres/primary-instance
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
paths:
7+
- rds-postgres/primary-instance/**
8+
types:
9+
- closed
10+
- opened
11+
- reopened
12+
- synchronize
13+
jobs:
14+
terraform:
15+
uses: ./.github/workflows/terraform.yml
16+
concurrency: ${{ github.workflow }}
17+
with:
18+
module: rds-postgres/primary-instance
19+
permissions:
20+
id-token: write
21+
contents: write
22+
checks: write
23+
pull-requests: write
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: rds-postgres/rds-postgres-login
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
paths:
7+
- rds-postgres/rds-postgres-login/**
8+
types:
9+
- closed
10+
- opened
11+
- reopened
12+
- synchronize
13+
jobs:
14+
terraform:
15+
uses: ./.github/workflows/terraform.yml
16+
concurrency: ${{ github.workflow }}
17+
with:
18+
module: rds-postgres/rds-postgres-login
19+
permissions:
20+
id-token: write
21+
contents: write
22+
checks: write
23+
pull-requests: write
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: rds-postgres/replica
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
paths:
7+
- rds-postgres/replica/**
8+
types:
9+
- closed
10+
- opened
11+
- reopened
12+
- synchronize
13+
jobs:
14+
terraform:
15+
uses: ./.github/workflows/terraform.yml
16+
concurrency: ${{ github.workflow }}
17+
with:
18+
module: rds-postgres/replica
19+
permissions:
20+
id-token: write
21+
contents: write
22+
checks: write
23+
pull-requests: write
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: rds-postgres/security-group-ingress
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
paths:
7+
- rds-postgres/security-group-ingress/**
8+
types:
9+
- closed
10+
- opened
11+
- reopened
12+
- synchronize
13+
jobs:
14+
terraform:
15+
uses: ./.github/workflows/terraform.yml
16+
concurrency: ${{ github.workflow }}
17+
with:
18+
module: rds-postgres/security-group-ingress
19+
permissions:
20+
id-token: write
21+
contents: write
22+
checks: write
23+
pull-requests: write

.github/workflows/security-group.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: rds-postgres/security-group
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
paths:
7+
- rds-postgres/security-group/**
8+
types:
9+
- closed
10+
- opened
11+
- reopened
12+
- synchronize
13+
jobs:
14+
terraform:
15+
uses: ./.github/workflows/terraform.yml
16+
concurrency: ${{ github.workflow }}
17+
with:
18+
module: rds-postgres/security-group
19+
permissions:
20+
id-token: write
21+
contents: write
22+
checks: write
23+
pull-requests: write
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: terraform-missing
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
types:
7+
- closed
8+
- opened
9+
- reopened
10+
- synchronize
11+
jobs:
12+
check-terraform-missing:
13+
runs-on: [ubuntu-22.04]
14+
defaults:
15+
run:
16+
shell: bash
17+
steps:
18+
19+
- name: Checkout
20+
uses: actions/checkout@v2
21+
22+
- name: Find missing workflows
23+
run: bin/find-missing-github-workflows

.github/workflows/terraform.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Terraform
2+
on:
3+
workflow_call:
4+
inputs:
5+
terraform_version:
6+
default: 1.6.2
7+
type: string
8+
module:
9+
type: string
10+
required: true
11+
12+
jobs:
13+
validate:
14+
name: Terraform
15+
runs-on:
16+
- ubuntu-22.04
17+
defaults:
18+
run:
19+
shell: bash
20+
working-directory: ${{ inputs.module }}
21+
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
with:
26+
ref: ${{ github.event.pull_request.head.ref }}
27+
28+
- name: Setup Terraform
29+
uses: hashicorp/setup-terraform@v2
30+
with:
31+
terraform_version: ${{ inputs.terraform_version }}
32+
terraform_wrapper: false
33+
34+
- name: Setup Node
35+
uses: actions/setup-node@v2
36+
with:
37+
node-version: '14'
38+
39+
- name: Terraform Format
40+
id: fmt
41+
run: terraform fmt -check
42+
43+
- name: Cache tflint
44+
uses: actions/cache@v3
45+
with:
46+
path: ~/.tflint.d/plugins
47+
key: ${{ matrix.os }}-tflint-${{ hashFiles('.tflint.hcl') }}
48+
49+
- name: Setup TFLint
50+
uses: terraform-linters/setup-tflint@v1
51+
with:
52+
tflint_version: v0.45.0
53+
54+
- name: Init tflint
55+
id: lintinit
56+
run: tflint --init --config="$GITHUB_WORKSPACE/.tflint.hcl"
57+
env:
58+
GITHUB_TOKEN: ${{ github.token }}
59+
60+
- name: Run tflint
61+
id: lint
62+
run: tflint --config="$GITHUB_WORKSPACE/.tflint.hcl" --format=compact
63+
64+
docs:
65+
name: tf-docs
66+
runs-on:
67+
- ubuntu-22.04
68+
needs: validate
69+
defaults:
70+
run:
71+
shell: bash
72+
working-directory: ${{ inputs.module }}
73+
74+
steps:
75+
- name: Checkout
76+
uses: actions/checkout@v4
77+
with:
78+
ref: ${{ github.event.pull_request.head.ref }}
79+
80+
- name: Update Docs
81+
uses: terraform-docs/[email protected]
82+
with:
83+
working-dir: ${{ inputs.module }}
84+
output-file: README.md
85+
output-method: inject
86+
git-push: "true"

0 commit comments

Comments
 (0)