-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.yml
More file actions
35 lines (28 loc) · 871 Bytes
/
main.yml
File metadata and controls
35 lines (28 loc) · 871 Bytes
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
name: Terraform EC2 Instance
on:
push:
branches:
- main
jobs:
terraform:
name: Terraform
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
with:
terraform_version: 1.0.0
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-1 # Ensure the region matches the one in your Terraform configuration
- name: Initialize Terraform
run: terraform init
- name: Plan Terraform
run: terraform plan
- name: Apply Terraform
run: terraform apply -auto-approve