Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: initial functionality #1

Merged
merged 2 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "devcontainer",
"image": "mcr.microsoft.com/vscode/devcontainers/base:ubuntu-22.04",
"features": {
"ghcr.io/devcontainers/features/aws-cli:1": {
"version": "latest"
},
"ghcr.io/devcontainers-contrib/features/checkov:1": {
"version": "latest"
},
"ghcr.io/devcontainers/features/terraform:1": {
"version": "1.6.2",
"tflint": "0.48.0",
"installTFsec": "true",
"installTerraformDocs": "true"
},
"ghcr.io/devcontainers-contrib/features/pre-commit:2": {
"version": "latest"
},
"ghcr.io/devcontainers-contrib/features/terrascan:1": {
"version": "latest"
}
},
"shutdownAction": "stopContainer",
"postCreateCommand": {
"one": "tflint --init"
}
}
26 changes: 26 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs
# For more information about the EditorConfig project, see http://editorconfig.org/

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
max_line_length = 80
trim_trailing_whitespace = true

# Indentation and spacing
[*.tf]
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false

# Ignore files generated by Terraform
[*.tfstate]
[*.tfstate.*]
[*.tfvars]
[*.tfvars.*]
19 changes: 19 additions & 0 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: pr-checks
on:
- pull_request

permissions:
contents: read
issues: read
pull-requests: read
checks: read

jobs:
check_pull_request_type:
name: Check for pull request type label
runs-on: ubuntu-latest
steps:
- uses: docker://agilepathway/pull-request-label-checker:latest
with:
one_of: bug,enhancement,documentation,security
repo_token: ${{ secrets.GITHUB_TOKEN }}
36 changes: 36 additions & 0 deletions .github/workflows/tf-module-actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: tf-module-actions
on:
- pull_request
permissions:
contents: write
pull-requests: write
issues: write
checks: write
jobs:
checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Render terraform docs inside the README.md and push changes back to PR branch
uses: terraform-docs/[email protected]
with:
working-dir: .,examples/01_default_configuration
output-file: README.md
output-method: inject
git-push: "true"
- name: Run Trivy vulnerability scanner in IaC mode
uses: aquasecurity/[email protected]
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'
28 changes: 28 additions & 0 deletions .github/workflows/tf-module-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Release

on:
workflow_dispatch:
push:
branches:
- main
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
fetch-depth: 0

- name: Release
uses: cycjimmy/semantic-release-action@v3
with:
semantic_version: 18.0.0
extra_plugins: |
@semantic-release/[email protected]
@semantic-release/[email protected]
[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34 changes: 34 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Local .terraform directories
**/.terraform/*

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

# Terraform lock files
*.lock.hcl

# Crash log files
crash.log

# Ignore override files as they are usually used to override resources locally and so are not checked in
override.tf
override.tf.json
*_override.tf
*_override.tf.json

# Ignore CLI configuration files
.terraformrc
terraform.rc

# VSCode History plugin
.history

# Python virtual environment
.venv

# JetBrains IDEs
.idea

# Lambda zip directory
out/
33 changes: 33 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.83.5
hooks:
- id: terraform_fmt
- id: terraform_validate
- id: terraform_docs
args:
- '--args=--lockfile=false'
- id: terraform_tflint
args:
- '--args=--only=terraform_deprecated_interpolation'
- '--args=--only=terraform_deprecated_index'
- '--args=--only=terraform_unused_declarations'
- '--args=--only=terraform_comment_syntax'
- '--args=--only=terraform_documented_outputs'
- '--args=--only=terraform_documented_variables'
- '--args=--only=terraform_typed_variables'
- '--args=--only=terraform_module_pinned_source'
- '--args=--only=terraform_naming_convention'
- '--args=--only=terraform_required_version'
- '--args=--only=terraform_required_providers'
- '--args=--only=terraform_standard_module_structure'
- '--args=--only=terraform_workspace_remote'
- id: terraform_checkov
args:
- --args=--quiet
- --args=--skip-check CKV_AWS_116,CKV_AWS_117,CKV_AWS_173,CKV_AWS_272
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-merge-conflict
- id: end-of-file-fixer
71 changes: 71 additions & 0 deletions .releaserc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
branches:
- main

ci: false

plugins:
- "@semantic-release/commit-analyzer"
- "@semantic-release/release-notes-generator"
- "@semantic-release/github"

verifyConditions:
- '@semantic-release/git'
- "@semantic-release/github"
analyzeCommits:
- path: "@semantic-release/commit-analyzer"
releaseRules:
- type: "feat"
release: "patch"
- type: "hotfix"
release: "patch"
- type: "patch"
release: "patch"
- type: "minor"
release: "minor"
- type: "breaking"
release: "major"
generateNotes:
- path: "@semantic-release/release-notes-generator"
writerOpts:
groupBy: "type"
commitGroupsSort:
- "feat"
- "perf"
- "fix"
commitsSort: "header"
types:
- type: "feat"
- section: "Features"
# Tracked bug fix with a hotfix branch
- type: "hotfix"
- section: "Bug Fixes"
# Uninmportent fix (CI testing, etc)
- type: "fix"
- hidden: true
- type: "chore"
- hidden: true
- type: "docs"
- hidden: true
- type: "doc"
- hidden: true
- type: "style"
- hidden: true
- type: "refactor"
- hidden: true
- type: "perf"
- hidden: true
- type: "test"
- hidden: true
presetConfig: true
prepare:
- path: "@semantic-release/git"
- path: "@semantic-release/changelog"
changelogFile: "docs/CHANGELOG.md"
publish:
- path: "@semantic-release/github"

success:
- "@semantic-release/github"

fail:
- "@semantic-release/github"
8 changes: 8 additions & 0 deletions .terraform-docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
formatter: "markdown table"
sort:
enabled: true
by: name

output:
file: README.md
mode: inject
Loading