Skip to content

Commit da31370

Browse files
committed
ci: add terraform workflow
1 parent 9a8579c commit da31370

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed

.github/workflows/terraform.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
name: Terraform
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
9+
env:
10+
# S3 backend configuration
11+
AWS_ENDPOINT_URL_S3: ${{ vars.AWS_ENDPOINT_URL_S3 }}
12+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
13+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
14+
# GitHub App configuration
15+
GITHUB_OWNER: ${{ vars.GH_OWNER }}
16+
GITHUB_APP_ID: ${{ vars.GH_APP_ID }}
17+
GITHUB_APP_INSTALLATION_ID: ${{ vars.GH_APP_INSTALLATION_ID }}
18+
GITHUB_APP_PEM_FILE: ${{ secrets.GH_APP_PEM_FILE }}
19+
# Terraform configuration
20+
TF_WORKSPACE: ${{ github.repository_owner }}
21+
TF_VAR_config: test.yaml
22+
TF_IN_AUTOMATION: true
23+
24+
defaults:
25+
run:
26+
shell: bash
27+
28+
jobs:
29+
terraform:
30+
name: Terraform Apply
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: Checkout the repository
34+
uses: actions/checkout@v6
35+
- name: Set up Terraform
36+
uses: hashicorp/setup-terraform@v4
37+
with:
38+
terraform_version: 1.14.7
39+
- name: Terraform init
40+
id: init
41+
run: terraform -chdir=terraform init -input=false
42+
- name: Terraform Apply
43+
run: terraform -chdir=terraform apply -auto-approve -input=false

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,24 @@ repositories:
5454
- name: .github
5555
```
5656
57+
### GitHub Workflow
58+
59+
Set up GitHub actions, variables and secrets:
60+
61+
- GitHub / *Repository* / Settings
62+
- Secrets and variables / Actions / Actions secrets and variables
63+
- Secrets
64+
- **New repository secret**
65+
- `GH_APP_PEM_FILE` (`GITHUB_APP_PEM_FILE_PATH` contents)
66+
- `AWS_ACCESS_KEY_ID`
67+
- `AWS_SECRET_ACCESS_KEY`
68+
- Variables
69+
- **New repository variable**
70+
- `GH_OWNER` (`GITHUB_OWNER`)
71+
- `GH_APP_ID` (`GITHUB_APP_ID`)
72+
- `GH_APP_INSTALLATION_ID` (`GITHUB_APP_INSTALLATION_ID`)
73+
- `AWS_ENDPOINT_URL_S3`
74+
5775
## Usage
5876

5977
### GitHub Organization Configuration YAML

0 commit comments

Comments
 (0)