From 4eb76470f9dc83486d9a0fb99700c9326285b3e4 Mon Sep 17 00:00:00 2001 From: Niel Markwick Date: Fri, 13 Sep 2024 16:25:33 +0200 Subject: [PATCH] feat: add terraform validation --- .github/workflows/codehealth.yml | 7 +++++-- cloudrun-malware-scanner/.husky/pre-commit | 1 + cloudrun-malware-scanner/package.json | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/codehealth.yml b/.github/workflows/codehealth.yml index ba3df6bc..c28e2538 100644 --- a/.github/workflows/codehealth.yml +++ b/.github/workflows/codehealth.yml @@ -47,8 +47,11 @@ jobs: - name: terraform validate infra working-directory: terraform/infra/ - run: terraform validate -no-color + terraform init -no-color + terraform validate -no-color - name: terraform validate service working-directory: terraform/service/ - run: terraform validate -no-color + run: | + terraform init -no-color + terraform validate -no-color diff --git a/cloudrun-malware-scanner/.husky/pre-commit b/cloudrun-malware-scanner/.husky/pre-commit index f24bc74e..7f1c14ac 100644 --- a/cloudrun-malware-scanner/.husky/pre-commit +++ b/cloudrun-malware-scanner/.husky/pre-commit @@ -4,4 +4,5 @@ cd cloudrun-malware-scanner npm run eslint npm run check-format npm run typecheck +npm run terraform-validate npm audit diff --git a/cloudrun-malware-scanner/package.json b/cloudrun-malware-scanner/package.json index a9539531..bfc5f9b3 100644 --- a/cloudrun-malware-scanner/package.json +++ b/cloudrun-malware-scanner/package.json @@ -8,6 +8,7 @@ "start": "node server.js", "terraform-fmt": "terraform fmt ../terraform/*/*.tf ../terraform/*/*/*.tf", "terraform-fmt-check": "terraform fmt -check ../terraform/*/*.tf ../terraform/*/*/*.tf", + "terraform-validate": "echo 'validating terraform/infra' && cd ../terraform/infra && terraform init && terraform validate && echo 'validating terraform/service' && cd ../service && terraform init && terraform validate", "prettier": "prettier --config .prettierrc.js --write ..", "prettier-check": "prettier --config .prettierrc.js --check --log-level=warn ..", "start-proxy": "node gcs-proxy-server.js",