Skip to content

Commit

Permalink
Added tfsec step
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronaldo Macapobre committed Aug 20, 2024
1 parent 1b8f3c9 commit d392cb9
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 7 deletions.
16 changes: 14 additions & 2 deletions .github/workflows/aws-template-terraform.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: AWS Bootstrap Workflow
name: AWS Template Workflow

on:
workflow_call:
Expand Down Expand Up @@ -52,6 +52,18 @@ jobs:
done < files.txt
echo "infra_changed=$infra_changed" >> "$GITHUB_OUTPUT"
scan:
name: Scan TF Code
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run tfsec
uses: aquasecurity/tfsec-action
with:
working_directory: ${{ inputs.CONTEXT_FOLDER }}
needs: [check_changes]

deploy_infra:
name: Deploy Infra
runs-on: ubuntu-latest
Expand All @@ -62,7 +74,7 @@ jobs:
TF_VAR_environment: ${{ vars.ENVIRONMENT_NAME }}
TF_VAR_kms_key_name: ${{ vars.KMS_KEY_NAME }}
TF_VAR_vpc_id: ${{ vars.VPC_ID }}
needs: [check_changes]
needs: [scan]
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down
28 changes: 23 additions & 5 deletions .github/workflows/deploy-infra-dev.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,32 @@
name: Deploy AWS Infra to Dev
name: Publish Infra

on:
# PR targeting master is created or new commits are pushed
push:
branches:
- master
paths:
- "infra/**"

# Manual trigger via GH Actions UI
workflow_dispatch:
inputs:
environment:
description: "Select target environment"
required: true
default: "dev"
type: choice
options:
- dev
- test
- prod

jobs:
infrastructure_deploy_dev:
deploy:
uses: ./.github/workflows/aws-template-terraform.yml
with:
CONTEXT_FOLDER: ./infrastructure/cloud/environments/dev
CHANGE_FOLDER_NAME: environments/dev
ENVIRONMENT_NAME: dev
CONTEXT_FOLDER: "./infrastructure/cloud/environments/${{ inputs.environment }}"
CHANGE_FOLDER_NAME: environments/${{ inputs.environment }}
ENVIRONMENT_NAME: ${{ inputs.environment }}
TEST_BUCKET_NAME: jasper-test-bucket
secrets: inherit

0 comments on commit d392cb9

Please sign in to comment.