Skip to content

Commit

Permalink
Merge pull request #3 from rhythmictech/inspectorv2
Browse files Browse the repository at this point in the history
major overhaul of module for inspector2 and multi-account support
  • Loading branch information
cdaniluk authored Oct 1, 2024
2 parents a1e76bf + 5502970 commit 97e3e99
Show file tree
Hide file tree
Showing 22 changed files with 703 additions and 122 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @rhythmictech/engineering
20 changes: 0 additions & 20 deletions .github/workflows/check.yml

This file was deleted.

23 changes: 23 additions & 0 deletions .github/workflows/misspell.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: misspell
on:
push:
branches:
- main
- master
- prod
- develop

jobs:
misspell:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: misspell
uses: reviewdog/action-misspell@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
locale: "US"
reporter: github-check
filter_mode: nofilter
level: error
31 changes: 31 additions & 0 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: pre-commit-check
on:
push:
branches:
- main
- master
- prod
- develop

jobs:
pre-commit-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
- name: Install prerequisites
run: ./bin/install-ubuntu.sh
- name: initialize Terraform
run: terraform init --backend=false
- name: pre-commit
uses: pre-commit/action@v2.0.3
env:
AWS_DEFAULT_REGION: us-east-1
# many of these are covered by better reviewdog linters below
SKIP: >-
terraform_tflint_deep,
no-commit-to-branch,
terraform_tflint_nocreds,
terraform_tfsec
81 changes: 81 additions & 0 deletions .github/workflows/pullRequest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
name: pull request
on:
pull_request:

jobs:
# TODO: #22 add job using https://github.com/reviewdog/action-alex
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
- name: Install prerequisites
run: ./bin/install-ubuntu.sh
- name: initialize Terraform
run: terraform init --backend=false
- name: pre-commit
uses: pre-commit/action@v2.0.3
env:
AWS_DEFAULT_REGION: us-east-1
# many of these are covered by better reviewdog linters below
SKIP: >-
terraform_tflint_deep,
no-commit-to-branch,
terraform_tflint_nocreds,
terraform_trivy
tflint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install prerequisites
run: ./bin/install-ubuntu.sh
- name: Terraform init
run: terraform init --backend=false
- name: tflint
uses: reviewdog/action-tflint@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-check
filter_mode: added
flags: --module
level: error
trivy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install prerequisites
run: ./bin/install-ubuntu.sh
- name: Terraform init
run: terraform init --backend=false
- name: tfsec
uses: reviewdog/action-tfsec@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-check
filter_mode: added
level: warning
misspell:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: misspell
uses: reviewdog/action-misspell@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
locale: "US"
reporter: github-pr-check
filter_mode: added
level: error
yamllint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: yamllint
uses: reviewdog/action-yamllint@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-check
filter_mode: added
level: error
27 changes: 27 additions & 0 deletions .github/workflows/tflint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: tflint
on:
push:
branches:
- main
- master
- prod
- develop

jobs:
tflint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install prerequisites
run: ./bin/install-ubuntu.sh
- name: Terraform init
run: terraform init --backend=false
- name: tflint
uses: reviewdog/action-tflint@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-check
filter_mode: nofilter
flags: --module
level: error
31 changes: 31 additions & 0 deletions .github/workflows/trivy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: trivy
on:
push:
branches:
- master

jobs:
trivy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install prerequisites
run: ./bin/install-ubuntu.sh
- name: Terraform init
run: terraform init --backend=false
- name: Trivy scan
uses: aquasecurity/trivy-action@master
with:
scan-type: 'config'
hide-progress: false
format: 'sarif'
output: 'trivy-results.sarif'
exit-code: '1'
ignore-unfixed: true
severity: 'CRITICAL,HIGH'

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: 'trivy-results.sarif'
22 changes: 22 additions & 0 deletions .github/workflows/yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: yamllint
on:
push:
branches:
- main
- master
- prod
- develop

jobs:
yamllint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: yamllint
uses: reviewdog/action-yamllint@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-check
filter_mode: nofilter
level: error
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Local .terraform directories
**/.terraform/*

# .tfstate files
*.tfstate
*.tfstate.*

# .tfvars files
*.tfvars

# macs
.DS_Store

# temp folders
tmp
65 changes: 53 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,54 @@
---
exclude: ".terraform"
repos:
- repo: git://github.com/antonbabenko/pre-commit-terraform
rev: v1.19.0
hooks:
- id: terraform_fmt
- id: terraform_docs
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- id: no-commit-to-branch
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.92.2
hooks:
- id: terraform_docs
always_run: true
- id: terraform_fmt
- id: terraform_validate
args:
- --hook-config=--retry-once-with-cleanup=true
exclude: ^examples
- id: terraform_tflint
alias: terraform_tflint_nocreds
exclude: ^examples
name: terraform_tflint_nocreds
- id: terraform_trivy
args:
- --args=--skip-dirs="**/.terraform,examples/*"
- id: terraform_providers_lock
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-json
- id: check-merge-conflict
- id: check-symlinks
- id: check-yaml
args:
- --unsafe
- id: detect-private-key
- id: end-of-file-fixer
- id: mixed-line-ending
args:
- --fix=lf
- id: no-commit-to-branch
args:
- --branch
- main
- --branch
- master
- --branch
- prod
- id: pretty-format-json
args:
- --autofix
- --top-keys=name,Name
- id: trailing-whitespace
args:
- --markdown-linebreak-ext=md
exclude: README.md
ci:
skip: [terraform_docs, terraform_fmt, terraform_validate, terraform_tflint, terraform_trivy, terraform_providers_lock]
2 changes: 1 addition & 1 deletion .terraform-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.12.13
latest:^1.6
25 changes: 25 additions & 0 deletions .terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 97e3e99

Please sign in to comment.