-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make terraform-validate script executable Initial commit
- Loading branch information
0 parents
commit 40c0423
Showing
8 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v2.4.0 | ||
hooks: | ||
- id: check-added-large-files | ||
- id: check-byte-order-marker | ||
- id: check-case-conflict | ||
- id: check-executables-have-shebangs | ||
- id: check-json | ||
- id: check-merge-conflict | ||
- id: check-symlinks | ||
- id: check-yaml | ||
- id: detect-private-key | ||
- id: end-of-file-fixer | ||
- id: mixed-line-ending | ||
args: [--fix=no] | ||
- id: trailing-whitespace | ||
- repo: https://github.com/gruntwork-io/pre-commit | ||
rev: v0.0.8 | ||
hooks: | ||
- id: shellcheck |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# This configuration file allows our pre-commit hooks to be used with pre-commit: http://pre-commit.com/ | ||
|
||
- id: terraform-validate | ||
name: Terraform validate | ||
description: Validates all Terraform configuration files | ||
entry: hooks/terraform-validate.sh | ||
language: script | ||
files: \.tf$ | ||
exclude: \.+.terraform\/.*$ | ||
require_serial: true | ||
args: [--azurerm-provider-version=2.25.0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "@quantum-sec/semantic-release-config/base" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
© 2020 Quantum Security Pte. Ltd. All Rights Reserved. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
trigger: | ||
branches: | ||
include: | ||
- master | ||
- feature/* | ||
- fix/* | ||
|
||
resources: | ||
repositories: | ||
- repository: pipeline-library | ||
type: github | ||
endpoint: quantum-sec-github | ||
name: quantum-sec/pipeline-library | ||
|
||
jobs: | ||
- template: templates/jobs/default.yml@pipeline-library |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
# This is a clone of https://github.com/gruntwork-io/pre-commit/blob/master/hooks/terraform-validate.sh | ||
# It adds support for modules that use the Azure Resource Manager provider 2.0+. | ||
# This provider requires an explicit `features` block which in most cases is supplied by a super module. | ||
# See: https://github.com/hashicorp/terraform/pull/24896 | ||
|
||
function main() { | ||
local azurerm_provider_version="2.25.0" | ||
|
||
if [[ "$1" = "--azurerm-provider-version"* ]]; then | ||
azurerm_provider_version="${1//--azurerm-provider-version=/}" | ||
fi | ||
|
||
for dir in $(echo "$@" | xargs -n1 dirname | sort -u | uniq); do | ||
pushd "$dir" >/dev/null | ||
if [ -n "$azurerm_provider_version" ]; then | ||
cat << EOF > provider.tf | ||
provider "azurerm" { | ||
version = "$azurerm_provider_version" | ||
features {} | ||
} | ||
EOF | ||
fi | ||
terraform init -backend=false | ||
terraform validate | ||
rm provider.tf | ||
popd >/dev/null | ||
done | ||
} | ||
|
||
main "$@" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"name": "@quantum-sec/pre-commit", | ||
"version": "0.0.0-development", | ||
"repository": { | ||
"type": "git", | ||
"url": "[email protected]:quantum-sec/pre-commit.git" | ||
}, | ||
"author": "Quantum Security Pte. Ltd.", | ||
"license": "SEE LICENSE IN LICENSE" | ||
} |