-
Notifications
You must be signed in to change notification settings - Fork 27
62 lines (54 loc) · 1.48 KB
/
eks_node.yaml
File metadata and controls
62 lines (54 loc) · 1.48 KB
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
61
62
name: EKS Terraform Deployment
on:
# push:
#branches:
# - main
# paths:
# - 'terraform/eks_nodegroup/**'
pull_request:
branches:
- main
paths:
- 'terraform/eks_nodegroup/**'
workflow_dispatch:
inputs:
action:
description: "Specify the Terraform action: apply or destroy"
required: true
default: "apply"
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-east-1
jobs:
terraform:
runs-on: ubuntu-latest
defaults:
run:
working-directory: terraform/eks_nodegroup
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Set up Terraform
uses: hashicorp/setup-terraform@v1
with:
terraform_wrapper: true
- name: Initialize Terraform
run: terraform init
- name: Validate Terraform
run: terraform validate
- name: Terraform Plan
run: terraform plan
- name: Execute Terraform Action
run: |
if [ "${{ github.event.inputs.action }}" == "destroy" ]; then
terraform destroy -auto-approve
else
terraform apply -auto-approve
fi