Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-svensson authored Nov 10, 2022
0 parents commit c8af398
Show file tree
Hide file tree
Showing 11 changed files with 157 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const Configuration = {

extends: ['@commitlint/config-conventional'],

/*
* Any rules defined here will override rules from @commitlint/config-conventional
*/
rules: {
'body-max-line-length': [2, 'always', 200],
},
};

module.exports = Configuration;
19 changes: 19 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: 2
updates:
- package-ecosystem: terraform
directory: "/"
schedule:
interval: "daily"
open-pull-requests-limit: 10

- package-ecosystem: terraform
directory: "/examples"
schedule:
interval: "daily"
open-pull-requests-limit: 10

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
open-pull-requests-limit: 10
28 changes: 28 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Build

on: [ push, workflow_dispatch ]

jobs:
examples:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest ]
tf-version: [ 1.1.9, 1.2.9, 1.3.2 ]
steps:
- name: Install terraform v${{ matrix.tf-version }}
run: |
curl -LO https://releases.hashicorp.com/terraform/${{ matrix.tf-version }}/terraform_${{ matrix.tf-version }}_linux_amd64.zip
unzip terraform_${{ matrix.tf-version }}_linux_amd64.zip
sudo mv terraform /usr/local/bin
rm *
- name: Checkout code
uses: actions/checkout@v2
- name: Validate examples terraform v${{ matrix.tf-version }}
run: make examples
build:
needs: [examples]
runs-on: ubuntu-latest
steps:
- run: echo "OK"
14 changes: 14 additions & 0 deletions .github/workflows/commitlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Lint Commit Messages

on: [pull_request]

jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v5
with:
configFile: "./.github/commitlint.config.js"
30 changes: 30 additions & 0 deletions .github/workflows/terrascan.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Terrascan
on: [ pull_request ]
# https://github.com/marketplace/actions/terrascan-iac-scanner
jobs:
terrascan:
runs-on: ubuntu-latest
name: terrascan
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Run Terrascan
id: terrascan
uses: tenable/terrascan-action@main
with:
iac_type: 'terraform'
iac_version: 'v14'
policy_type: 'aws'
only_warn: true
sarif_upload: true
#non_recursive:
#iac_dir:
#policy_path:
#skip_rules:
#config_path:
#webhook_url:
#webhook_token:
- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: terrascan.sarif
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Local .terraform directories
**/.terraform/*

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

# Crash log files
crash.log
*.tfvars


examples/**/.terraform.lock.hcl
.idea
1 change: 1 addition & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @argoyle @peter-svensson
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Opzkit

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/make -f

SHELL = /bin/bash
EXAMPLES = $(shell find ./examples/* -maxdepth 1 -type d -not -path '*/\.*')

.PHONY: examples
examples: $(addprefix example/,$(EXAMPLES))

.PHONY: example/%
example/%:
@echo "Processing example: $(notdir $*)"
@terraform -chdir=$* init
@terraform -chdir=$* validate
@terraform -chdir=$* plan

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# tf-template
Template repository for Terraform modules
Empty file added examples/.gitkeep
Empty file.

0 comments on commit c8af398

Please sign in to comment.