Skip to content

Commit

Permalink
check
Browse files Browse the repository at this point in the history
  • Loading branch information
0katrinpetrosyan0 committed Jul 15, 2022
1 parent da98b7e commit 1cd4a20
Show file tree
Hide file tree
Showing 13 changed files with 445 additions and 209 deletions.
17 changes: 7 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
# Why
Somehow AWS does not have same tooling out of the box compared to GCP.
Automate creation of Terraform README documentation and format modules before commit to github repo.

## How
## Why
Modules to quickly spin up fully functional of monitoring.
Using terraform-docs and terraform fmt and pre-commit hooks
Using pre-commit hooks

## What hooks we use

We use terraform-fmt, terraform-docs, trailing whitespace, detect-aws-credentials, check-merge-conflict, detect-private-key.

## Requirements for pre-commit hooks
for Run our pre-commit hooks you need to install
- terraform
- terraform-docs

## Config for GitHooks

Expand All @@ -19,7 +18,5 @@ git config core.hooksPath githooks

## What
- aws-security-hub-opsgenie
- terraform-docs
- terraform fmt
- aws-billing
- pre-commit hooks

31 changes: 15 additions & 16 deletions githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
#!/bin/bash
echo 'Start git pre-commit hooks and checks... ';
sudo pre-commit run -a;
echo 'End git pre-commit hooks and checks... ';

echo "Start git pre-commit hooks";

echo "Start terraform docs";
echo 'Start terraform docs';
for i in `ls -d modules/*/`;do
if ! git diff --cached --quiet "${i}"
if ! git diff --cached --quiet '${i}'
then
echo "Generating doc file: ${i}";
terraform-docs markdown table --output-file README.md --output-mode inject "${i}";
echo 'Generating doc file: ${i}';
terraform-docs markdown table --output-file README.md --output-mode inject '${i}';
fi
done
echo "End terraform docs";
echo 'End terraform docs';

echo "Start terraform fmt";
echo 'Start terraform fmt';
for y in $(find . -name '*.tf' -print)
do
if ! git diff --cached --quiet "${y}"
then
echo "Formatting the file: ${y}";
terraform fmt -write=true "${y}"
fi
if ! git diff --cached --quiet '${y}'
then
echo 'Formatting the file: "${y}"';
terraform fmt -write=true '${y}'
fi
done
echo "End terraform fmt";

echo "End git pre-commit hooks";
echo 'End terraform fmt';
51 changes: 0 additions & 51 deletions modules/aws-billing-opsgenie/README.md

This file was deleted.

35 changes: 0 additions & 35 deletions modules/aws-billing-opsgenie/sns.tf

This file was deleted.

91 changes: 0 additions & 91 deletions modules/aws-billing-opsgenie/variables.tf

This file was deleted.

Loading

0 comments on commit 1cd4a20

Please sign in to comment.