From e1ec34b094580d4031980ba962a144029ac683e2 Mon Sep 17 00:00:00 2001 From: James Woolfenden Date: Mon, 27 Jul 2020 14:22:05 +0100 Subject: [PATCH] fix for master --- .github/workflows/main.yml | 6 ------ .pre-commit-config.yaml | 2 +- example/examplea/Makefile | 28 ++++++++++++++++++++++++---- validate.ps1 | 1 + validate.sh | 1 + 5 files changed, 27 insertions(+), 11 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 719152b..fc6a8b4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -32,12 +32,6 @@ jobs: tf_actions_version: 0.12.28 tf_actions_subcommand: "validate" tf_actions_working_dir: "example/examplea" - - name: "Terraform fmt" - uses: hashicorp/terraform-github-actions@master - with: - tf_actions_version: 0.12.28 - tf_actions_subcommand: "fmt -check" - tf_actions_working_dir: "example/examplea" - name: Test with Checkov run: | pip install checkov diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index cc80331..c805863 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,7 +32,7 @@ repos: hooks: - id: markdownlint - repo: git://github.com/adrienverge/yamllint - rev: v1.23.0 + rev: v1.24.2 hooks: - id: yamllint name: yamllint diff --git a/example/examplea/Makefile b/example/examplea/Makefile index 7a6a760..c8b89bc 100644 --- a/example/examplea/Makefile +++ b/example/examplea/Makefile @@ -1,17 +1,30 @@ #Makefile +ifdef OS + BLAT = $(powershell -noprofile rm .\.terraform\ -force -recurse) +else + ifeq ($(shell uname), Linux) + RM = rm .terraform/modules/ -fr + BLAT= rm .terraform/ -fr + endif +endif .PHONY: all all: init plan build init: - rm -rf .terraform/modules/ + $(RM) terraform init -reconfigure -plan: init +plan: terraform plan -refresh=true -build: init +p: + terraform plan -refresh=true + +apply: build + +build: terraform apply -auto-approve check: init @@ -24,5 +37,12 @@ docs: terraform-docs md . > README.md valid: - tflint terraform fmt -check=true -diff=true + checkov -d . --external-checks-dir ../../checkov + +target: + @read -p "Enter Module to target:" MODULE; + terraform apply -target $$MODULE + +purge: + $(BLAT) diff --git a/validate.ps1 b/validate.ps1 index 0b0b593..3bab714 100644 --- a/validate.ps1 +++ b/validate.ps1 @@ -4,4 +4,5 @@ Set-Location example/examplea Remove-Item .terraform -force -Recurse -ErrorAction SilentlyContinue terraform init terraform validate +make valid Pop-Location diff --git a/validate.sh b/validate.sh index 2e2cb88..d96bce3 100644 --- a/validate.sh +++ b/validate.sh @@ -3,3 +3,4 @@ cd example/examplea || return rm .terraform -fr terraform init terraform validate +make valid