Skip to content

Commit e070d24

Browse files
committed
Add Terraform deployment workflow and enable manual trigger for tests
1 parent 0c7aeba commit e070d24

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Terraform Deploy
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- '**.tf'
8+
- '**.tfvars'
9+
- '.github/workflows/terraform-deploy.yml'
10+
11+
jobs:
12+
deploy:
13+
name: Terraform Apply
14+
runs-on: ubuntu-latest
15+
environment: production
16+
17+
env:
18+
AWS_REGION: eu-west-1
19+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
20+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
21+
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v4
25+
26+
- name: Setup Terraform
27+
uses: hashicorp/setup-terraform@v3
28+
with:
29+
terraform_version: 1.5.7
30+
31+
- name: Terraform Init
32+
run: terraform init
33+
34+
- name: Terraform Plan
35+
id: plan
36+
run: terraform plan -out=tfplan -no-color
37+
38+
- name: Terraform Apply
39+
run: terraform apply -auto-approve tfplan
40+
41+
- name: Output Results
42+
if: always()
43+
run: terraform output -json

.github/workflows/terraform-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Terraform Tests
22

33
on:
4+
workflow_dispatch:
45
push:
56
branches: [main]
67
paths:

0 commit comments

Comments
 (0)