Skip to content

Commit 40c0423

Browse files
committed
Initial commit
Make terraform-validate script executable Initial commit
0 parents  commit 40c0423

8 files changed

Lines changed: 101 additions & 0 deletions

.pre-commit-config.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v2.4.0
4+
hooks:
5+
- id: check-added-large-files
6+
- id: check-byte-order-marker
7+
- id: check-case-conflict
8+
- id: check-executables-have-shebangs
9+
- id: check-json
10+
- id: check-merge-conflict
11+
- id: check-symlinks
12+
- id: check-yaml
13+
- id: detect-private-key
14+
- id: end-of-file-fixer
15+
- id: mixed-line-ending
16+
args: [--fix=no]
17+
- id: trailing-whitespace
18+
- repo: https://github.com/gruntwork-io/pre-commit
19+
rev: v0.0.8
20+
hooks:
21+
- id: shellcheck

.pre-commit-hooks.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# This configuration file allows our pre-commit hooks to be used with pre-commit: http://pre-commit.com/
2+
3+
- id: terraform-validate
4+
name: Terraform validate
5+
description: Validates all Terraform configuration files
6+
entry: hooks/terraform-validate.sh
7+
language: script
8+
files: \.tf$
9+
exclude: \.+.terraform\/.*$
10+
require_serial: true
11+
args: [--azurerm-provider-version=2.25.0]

.releaserc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "@quantum-sec/semantic-release-config/base"
3+
}

LICENSE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
© 2020 Quantum Security Pte. Ltd. All Rights Reserved.

azure-pipelines.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
trigger:
2+
branches:
3+
include:
4+
- master
5+
- feature/*
6+
- fix/*
7+
8+
resources:
9+
repositories:
10+
- repository: pipeline-library
11+
type: github
12+
endpoint: quantum-sec-github
13+
name: quantum-sec/pipeline-library
14+
15+
jobs:
16+
- template: templates/jobs/default.yml@pipeline-library

hooks/terraform-validate.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
# This is a clone of https://github.com/gruntwork-io/pre-commit/blob/master/hooks/terraform-validate.sh
6+
# It adds support for modules that use the Azure Resource Manager provider 2.0+.
7+
# This provider requires an explicit `features` block which in most cases is supplied by a super module.
8+
# See: https://github.com/hashicorp/terraform/pull/24896
9+
10+
function main() {
11+
local azurerm_provider_version="2.25.0"
12+
13+
if [[ "$1" = "--azurerm-provider-version"* ]]; then
14+
azurerm_provider_version="${1//--azurerm-provider-version=/}"
15+
fi
16+
17+
for dir in $(echo "$@" | xargs -n1 dirname | sort -u | uniq); do
18+
pushd "$dir" >/dev/null
19+
if [ -n "$azurerm_provider_version" ]; then
20+
cat << EOF > provider.tf
21+
provider "azurerm" {
22+
version = "$azurerm_provider_version"
23+
features {}
24+
}
25+
EOF
26+
fi
27+
terraform init -backend=false
28+
terraform validate
29+
rm provider.tf
30+
popd >/dev/null
31+
done
32+
}
33+
34+
main "$@"

package-lock.json

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "@quantum-sec/pre-commit",
3+
"version": "0.0.0-development",
4+
"repository": {
5+
"type": "git",
6+
"url": "git@github.com:quantum-sec/pre-commit.git"
7+
},
8+
"author": "Quantum Security Pte. Ltd.",
9+
"license": "SEE LICENSE IN LICENSE"
10+
}

0 commit comments

Comments
 (0)