Skip to content

Commit 2b30625

Browse files
SRAlexanderScott Alexander
andauthored
new action for virus scanner deployment added (#151)
* new actions for virus scanner deployement added --------- Co-authored-by: Scott Alexander <[email protected]>
1 parent 00d68e1 commit 2b30625

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# .github/workflows/terraform-dev
2+
name: 'Deploy Virus Scanner'
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
buildBranch:
8+
description: 'Feature branch to push to sandbox.'
9+
required: true
10+
type: 'string'
11+
sandboxWorkspace:
12+
description: 'Which Sandbox to push to.'
13+
required: true
14+
type: 'string'
15+
environment:
16+
description: 'Environment to run against'
17+
required: true
18+
type: 'string'
19+
20+
permissions:
21+
pull-requests: write
22+
id-token: write # This is required for requesting the JWT
23+
contents: read # This is required for actions/checkout
24+
25+
jobs:
26+
terraform_process:
27+
runs-on: ubuntu-latest
28+
environment: ${{ github.event.inputs.environment}}
29+
30+
steps:
31+
# Checkout the repository to the GitHub Actions runner
32+
- name: Checkout
33+
uses: actions/checkout@v3
34+
with:
35+
ref: ${{ github.event.inputs.buildBranch}}
36+
37+
- name: Configure AWS Credentials
38+
uses: aws-actions/configure-aws-credentials@v2
39+
with:
40+
role-to-assume: ${{ secrets.AWS_ASSUME_ROLE }}
41+
role-skip-session-tagging: true
42+
aws-region: ${{ vars.AWS_REGION }}
43+
44+
- name: View AWS Role
45+
run: aws sts get-caller-identity
46+
47+
# Install the latest version of Terraform CLI and configure the Terraform CLI configuration file with a Terraform Cloud user API token
48+
- name: Setup Terraform
49+
uses: hashicorp/setup-terraform@v2
50+
with:
51+
terraform_version: 1.5.4
52+
terraform_wrapper: false
53+
54+
- name: Terraform Init
55+
id: init
56+
run: terraform init -backend-config="${{ github.event.inputs.sandboxWorkspace}}.tfbackend"
57+
working-directory: ./virusscanner/terraform
58+
shell: bash
59+
60+
- name: Terraform Set Workspace
61+
id: workspace
62+
run: terraform workspace select -or-create ${{ github.event.inputs.sandboxWorkspace}}
63+
working-directory: ./virusscanner/terraform
64+
shell: bash
65+
66+
# Checks that all Terraform configuration files adhere to a canonical format
67+
- name: Terraform Format
68+
run: terraform fmt -check
69+
working-directory: ./virusscanner/terraform
70+
71+
- name: Terraform Plan
72+
id: plan
73+
run: |
74+
terraform plan -input=false -no-color -var-file="${{vars.TF_VARS_FILE}}" -out tf.plan
75+
working-directory: ./virusscanner/terraform
76+
shell: bash
77+
78+
- name: Terraform Apply
79+
run: terraform apply -auto-approve -input=false tf.plan
80+
working-directory: ./virusscanner/terraform

0 commit comments

Comments
 (0)