diff --git a/.github/commitlint.config.js b/.github/commitlint.config.js new file mode 100644 index 0000000..c50801f --- /dev/null +++ b/.github/commitlint.config.js @@ -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; diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..d1f94de --- /dev/null +++ b/.github/dependabot.yml @@ -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 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..8da8a0c --- /dev/null +++ b/.github/workflows/build.yml @@ -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" diff --git a/.github/workflows/commitlint.yaml b/.github/workflows/commitlint.yaml index 67e6df3..bb8ad8c 100644 --- a/.github/workflows/commitlint.yaml +++ b/.github/workflows/commitlint.yaml @@ -1,11 +1,14 @@ name: Lint Commit Messages + on: [pull_request] jobs: commitlint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 - - uses: wagoid/commitlint-github-action@v4 + - uses: wagoid/commitlint-github-action@v5 + with: + configFile: "./.github/commitlint.config.js" diff --git a/.github/workflows/terrascan.yaml b/.github/workflows/terrascan.yaml new file mode 100644 index 0000000..bf97d17 --- /dev/null +++ b/.github/workflows/terrascan.yaml @@ -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 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4b3e2f9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,32 @@ +# Local .terraform directories +**/.terraform/* + +# .tfstate files +*.tfstate +*.tfstate.* + +# Crash log files +crash.log + +# Ignore any .tfvars files that are generated automatically for each Terraform run. Most +# .tfvars files are managed as part of configuration and so should be included in +# version control. +# +# example.tfvars + +# 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 + +# Include override files you do wish to add to version control using negated pattern +# +# !example_override.tf + +# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan +# example: *tfplan* + +examples/**/.terraform.lock.hcl +.idea diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 0000000..55e58dd --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1 @@ +* @argoyle @peter-svensson diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1faccaf --- /dev/null +++ b/Makefile @@ -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 + diff --git a/examples/.gitkeep b/examples/.gitkeep new file mode 100644 index 0000000..e69de29