-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (45 loc) · 1.55 KB
/
terraform.yml
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
name: Terraform Deployment
# on:
# repository_dispatch:
# types: [deploy-command]
on:
pull_request:
concurrency:
group: deploy-${{ github.ref }}
cancel-in-progress: true
jobs:
terraform:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
- uses: pnpm/action-setup@v2
- name: Installing Dependencies
run: pnpm install
- name: Configure AWS credentials
run: |
aws configure --profile digitalocean set aws_access_key_id ${{ secrets.DO_ACCESS_KEY }}
aws configure --profile digitalocean set aws_secret_access_key ${{ secrets.DO_SECRET_ACCESS_KEY }}
- name: Export DigitalOcean profile
run: export AWS_PROFILE=digitalocean
- name: Create .tfvars file
run: |
echo "do_token=${{ secrets.DO_TOKEN }}" >> ./terraform/.tfvars
echo "project_id=${{ secrets.DO_PROJECT_ID }}" >> ./terraform/.tfvars
- name: Terraform Plan
run: pnpm terraform plan
- name: Terraform Apply
run: pnpm terraform apply
# - name: Run Terraform
# run: |
# cd terraform_directory
# terraform init \
# -backend-config="profile=do" \
# -backend-config="bucket=<YOUR_S3_BUCKET>" \
# -backend-config="key=<YOUR_S3_KEY>" \
# -backend-config="region=<YOUR_S3_REGION>"
# terraform apply -auto-approve