Skip to content

Commit

Permalink
chore: adding a build pipeline badge and updating the makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
gambol99 committed May 2, 2024
1 parent 3a14d7d commit 0db0166
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 22 deletions.
82 changes: 62 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,20 @@ all:
documentation:
@echo "--> Generating documentation"
@terraform-docs markdown table --output-file ${PWD}/README.md --output-mode inject .
$(MAKE) documentation-modules
$(MAKE) documentation-examples

documentation-modules:
@echo "--> Generating documentation for modules"
@if [ -d modules ]; then \
find modules -type d -mindepth 1 -maxdepth 1 -exec terraform-docs markdown table --output-file README.md --output-mode inject {} \; ; \
fi

documentation-examples:
@echo "--> Generating documentation examples"
@find examples -type d -mindepth 1 -maxdepth 1 -exec terraform-docs markdown table --output-file README.md --output-mode inject {} \;
@if [ -d examples ]; then \
find examples -type d -mindepth 1 -maxdepth 1 -exec terraform-docs markdown table --output-file README.md --output-mode inject {} \; ; \
fi

init:
@echo "--> Running terraform init"
Expand All @@ -44,47 +53,80 @@ init:
security:
@echo "--> Running Security checks"
@tfsec .
$(MAKE) security-modules
$(MAKE) security-examples

security-modules:
@echo "--> Running Security checks on modules"
@if [ -d modules ]; then \
find modules -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \
echo "--> Validating $$dir"; \
tfsec $$dir; \
done; \
fi

security-examples:
@echo "--> Running Security checks on examples"
@find examples -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \
echo "--> Validating $$dir"; \
tfsec $$dir; \
done

validate-all:
@echo "--> Running all validation checks"
$(MAKE) validate
$(MAKE) validate-examples
@if [ -d examples ]; then \
find examples -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \
echo "--> Validating $$dir"; \
tfsec $$dir; \
done; \
fi

validate:
@echo "--> Running terraform validate"
@terraform init -backend=false
@terraform validate
$(MAKE) validate-modules
$(MAKE) validate-examples

validate-modules:
@echo "--> Running terraform validate on modules"
@if [ -d modules ]; then \
find modules -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \
echo "--> Validating $$dir"; \
terraform -chdir=$$dir init -backend=false; \
terraform -chdir=$$dir validate; \
done; \
fi

validate-examples:
@echo "--> Running terraform validate on examples"
@find examples -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \
echo "--> Validating $$dir"; \
terraform -chdir=$$dir init; \
terraform -chdir=$$dir validate; \
done
@if [ -d examples ]; then \
find examples -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \
echo "--> Validating $$dir"; \
terraform -chdir=$$dir init -backend=false; \
terraform -chdir=$$dir validate; \
done; \
fi

lint:
@echo "--> Running tflint"
@tflint --init
@tflint -f compact
$(MAKE) lint-modules
$(MAKE) lint-examples

lint-modules:
@echo "--> Running tflint on modules"
@if [ -d modules ]; then \
find modules -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \
echo "--> Linting $$dir"; \
tflint --chdir=$$dir --init; \
tflint --chdir=$$dir -f compact; \
done; \
fi

lint-examples:
@echo "--> Running tflint on examples"
@find examples -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \
echo "--> Linting $$dir"; \
tflint --chdir=$$dir --init; \
tflint --chdir=$$dir -f compact; \
done
@if [ -d examples ]; then \
find examples -type d -mindepth 1 -maxdepth 1 | while read -r dir; do \
echo "--> Linting $$dir"; \
tflint --chdir=$$dir --init; \
tflint --chdir=$$dir -f compact; \
done; \
fi

format:
@echo "--> Running terraform fmt"
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Account Baseline Alarms
![Github Actions](../../actions/workflows/terraform.yml/badge.svg)

# Terraform AWS Account Baseline Alarms

The following repository contains a Terraform module that creates CloudWatch alarms for the AWS account baseline. The alarms are based on the CIS AWS Foundations Benchmark v1.4.0. Notifications for these can be sent to email, Slack and or Microsoft teams.

Expand Down Expand Up @@ -114,4 +116,3 @@ module "account_baseline_alarms" {
|------|-------------|
| <a name="output_sns_topic_arn"></a> [sns\_topic\_arn](#output\_sns\_topic\_arn) | The ARN of the SNS topic |
<!-- END_TF_DOCS -->

0 comments on commit 0db0166

Please sign in to comment.