-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b1a4b95
commit 8c3be86
Showing
1 changed file
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
name: "Terraform" | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
# Working directory input from user. | ||
|
||
# Terraform action you want to perform | ||
action: | ||
description: 'Terraform Action to Perform' | ||
type: choice | ||
options: | ||
- Terraform_apply | ||
- Terraform_destroy | ||
|
||
jobs: | ||
terraform_apply: | ||
name: "Terraform_apply" | ||
if: ${{ github.event.inputs.action == 'Terraform_apply' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Terraform | ||
uses: hashicorp/setup-terraform@v1 | ||
|
||
- name: Terraform Init | ||
id: init | ||
run: terraform init | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
AWS_DEFAULT_REGION: ${{ secrets.REGION }} | ||
|
||
- name: Terraform Validate | ||
id: validate | ||
run: terraform validate -no-color | ||
|
||
- name: Terraform Apply | ||
id: apply | ||
run: terraform apply -auto-approve | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
AWS_DEFAULT_REGION: ${{ secrets.REGION }} | ||
|
||
terraform_destroy: | ||
name: "Terraform_destroy" | ||
if: ${{ github.event.inputs.action == 'Terraform_destroy' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Terraform | ||
uses: hashicorp/setup-terraform@v1 | ||
|
||
- name: Terraform Init | ||
id: init | ||
run: terraform init | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
AWS_DEFAULT_REGION: ${{ secrets.REGION }} | ||
|
||
- name: Terraform Destroy | ||
id: destroy | ||
working-directory: ${{ github.event.inputs.resource }} | ||
run: terraform destroy -auto-approve | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
AWS_DEFAULT_REGION: ${{ secrets.REGION }} |