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: rework codebase using universal addon #4

Merged
merged 7 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
18 changes: 16 additions & 2 deletions .github/RELEASE_DRAFTER.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,25 @@ categories:
- 'enhancement'
- title: 'Bug Fixes'
labels:
- 'fix'
- 'bugfix'
- 'bug'
- title: 'Documentation'
label: 'documentation'
- title: 'CI'
label: 'ci'
version-resolver:
major:
labels:
- 'major'
minor:
labels:
- 'feature'
- 'enhancement'
patch:
labels:
- 'ci'
- 'bug'
- 'documentation'
default: patch
change-template: '- $TITLE, by @$AUTHOR (#$NUMBER)'
template: |
# What's changed
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: pre-commit

permissions:
contents: read

on:
workflow_dispatch:
pull_request:
branches:
- main
- master

jobs:
pre-commit:
runs-on: ubuntu-22.04
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: asdf-vm/actions/install@v3
- uses: pre-commit/[email protected]
43 changes: 0 additions & 43 deletions .github/workflows/pre-commit.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Release Drafter
name: Release drafter

permissions:
contents: write
Expand All @@ -15,7 +15,7 @@ on:

jobs:
update_release_draft:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- uses: release-drafter/release-drafter@v5
with:
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/template-sync.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Template sync

on:
schedule:
- cron: '0 0 * * *' # every day at midnight
workflow_dispatch:

permissions:
contents: write
pull-requests: write

jobs:
universal-addon:
if: github.repository != 'lablabs/terraform-aws-eks-universal-addon'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.TEST_TOKEN }}

- name: actions-template-sync
uses: AndreasAugustin/actions-template-sync@v2
with:
github_token: ${{ secrets.TEST_TOKEN }}
source_repo_path: lablabs/terraform-aws-eks-universal-addon
upstream_branch: main
pr_labels: kind/sync
pr_branch_name_prefix: "feat/universal-addon-sync"
pr_title: "feat(sync): sync universal-addon changes"
pr_commit_msg: "feat(sync): sync universal-addon changes"
27 changes: 14 additions & 13 deletions .github/workflows/validate.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: Terraform validate

permissions:
contents: read

on:
workflow_dispatch:
pull_request:
Expand All @@ -10,11 +13,11 @@ on:
jobs:
versionExtract:
name: Extract min/max Terraform versions
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Extract Terraform min/max versions
id: minMax
Expand All @@ -26,7 +29,7 @@ jobs:
maxVersion: ${{ steps.minMax.outputs.maxVersion }}

terraform-validate:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
needs: versionExtract
strategy:
matrix:
Expand All @@ -35,17 +38,15 @@ jobs:
- ${{ needs.versionExtract.outputs.maxVersion }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: ${{ matrix.tf_ver }}

- name: Validate module
run: |
terraform init
terraform validate
- name: Validate example
run: |
cd examples/basic
terraform init
terraform validate
- name: Terraform Init
id: init
run: terraform init

- name: Terraform Validate
id: validate
run: terraform validate
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,3 @@ override.tf.json
# Ignore CLI configuration files
.terraformrc
terraform.rc

.terraform.lock.hcl
29 changes: 14 additions & 15 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: check-merge-conflict
Expand All @@ -10,23 +10,22 @@ repos:
- id: end-of-file-fixer

- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.71.0
rev: v1.88.2
hooks:
- id: terraform_fmt
- id: terraform_tflint
- id: terraform_validate
- id: terraform_checkov
- id: terraform_docs
args:
- '--args=--hide providers --sort-by required'

- repo: https://github.com/pecigonzalo/pre-commit-terraform-vars
rev: v1.0.0
hooks:
- id: terraform-vars
- id: terraform_fmt
- id: terraform_tflint
args:
- --args=--config=__GIT_WORKING_DIR__/.tflint.hcl
- id: terraform_validate
- id: terraform_checkov
args:
- '--args=--skip-check CKV_TF_1' #CKV_TF_1: "Ensure Terraform module sources use a commit hash"
- id: terraform_docs
args:
- '--args=--config=.terraform-docs.yml'

- repo: https://github.com/Yelp/detect-secrets
rev: v1.2.0
rev: v1.4.0
hooks:
- id: detect-secrets
args: ['--baseline', '.secrets.baseline']
Expand Down
14 changes: 12 additions & 2 deletions .secrets.baseline
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.1.0",
"version": "1.3.0",
"plugins_used": [
{
"name": "ArtifactoryDetector"
Expand All @@ -20,6 +20,9 @@
{
"name": "CloudantDetector"
},
{
"name": "GitHubTokenDetector"
},
{
"name": "HexHighEntropyString",
"limit": 3.0
Expand All @@ -46,6 +49,9 @@
{
"name": "PrivateKeyDetector"
},
{
"name": "SendGridDetector"
},
{
"name": "SlackDetector"
},
Expand All @@ -66,6 +72,10 @@
{
"path": "detect_secrets.filters.allowlist.is_line_allowlisted"
},
{
"path": "detect_secrets.filters.common.is_baseline_file",
"filename": ".secrets.baseline"
},
{
"path": "detect_secrets.filters.common.is_ignored_due_to_verification_policies",
"min_level": 2
Expand Down Expand Up @@ -99,5 +109,5 @@
}
],
"results": {},
"generated_at": "2021-12-09T12:48:22Z"
"generated_at": "2022-07-28T10:50:47Z"
}
6 changes: 6 additions & 0 deletions .templatesyncignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
modules
examples/basic/main.tf
main.tf
variables.tf
README.md
.secrets.baseline
34 changes: 34 additions & 0 deletions .terraform-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
formatter: markdown table

header-from: main.tf
footer-from: docs/.footer.md

content: |-
{{ .Header }}
{{ include "docs/.content.md" }}
{{ .Requirements }}
{{ .Providers }}
{{ .Modules }}
{{ .Resources }}
{{ include "docs/.inputs.md" }}
{{ .Inputs }}
{{ .Outputs }}
{{ .Footer }}

output:
file: README.md
mode: replace
template: |-
{{ .Content }}
{{- printf "\n" -}}

sections:
hide:
- providers

sort:
by: required

settings:
default: false
required: false
Loading
Loading