Skip to content

Commit

Permalink
Adding automated TF deployment to CI account
Browse files Browse the repository at this point in the history
  • Loading branch information
henrykie committed Jun 20, 2024
1 parent afab4bc commit 695a880
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 12 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/scoutsuite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: ScouteSuite
on:
pull_request:
branches:
["main"]
push:
branches:
["main"]

jobs:
Terraform:
strategy:
matrix: { dir: ["samples/simple-build-pipeline"] }
environment: aws-ci
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-east-1
## the following creates an ARN based on the values entered into github secrets
role-to-assume: ${{ secrets.AWS_CI_ROLE_ARN }}
role-session-name: CGDToolkitGitHubActions

- name: Terraform fmt
id: fmt
working-directory: ${{ matrix.dir }}
run: terraform fmt -check
continue-on-error: true

- name: Terraform Init
id: init
working-directory: ${{ matrix.dir }}
run: terraform init

- name: Terraform Validate
id: validate
working-directory: ${{ matrix.dir }}
run: terraform validate -no-color

- name: Terraform Plan
id: plan
working-directory: ${{ matrix.dir }}
run: terraform plan -no-color

- run: echo ${{ steps.plan.outputs.stdout }}
- run: echo ${{ steps.plan.outputs.stderr }}
- run: echo ${{ steps.plan.outputs.exitcode }}

13 changes: 1 addition & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,4 @@ repos:
- --args=--download-external-modules true
- id: terraform_validate
- id: terraform_fmt
- id: terraform_tflint
ci:
autofix_commit_msg: |
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
autofix_prs: true
autoupdate_branch: ''
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
autoupdate_schedule: weekly
skip: []
submodules: false
- id: terraform_tflint

0 comments on commit 695a880

Please sign in to comment.