Skip to content

Commit

Permalink
Merge pull request #1 from ukhsa-collaboration/feature/doe-99-add-pre…
Browse files Browse the repository at this point in the history
…commit-hooks

DOE-99: Add pre-commit hooks for Terraform
  • Loading branch information
ntse authored Dec 5, 2024
2 parents e1d7b82 + fb19c3d commit 7bc419b
Show file tree
Hide file tree
Showing 33 changed files with 39 additions and 31 deletions.
1 change: 0 additions & 1 deletion .github/workflows/dev_terraform_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,3 @@ jobs:
AZURE_TENANT_ID: "${{ secrets.AZURE_TENANT_ID }}"
AZURE_SUBSCRIPTION_ID: "${{ secrets.AZURE_SUBSCRIPTION_ID }}"
TF_MODULES_SSH_DEPLOY_KEY: ${{ secrets.TF_MODULES_SSH_DEPLOY_KEY }}

2 changes: 1 addition & 1 deletion .github/workflows/scheduled_destroy.yml.disabled
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ jobs:
AZURE_CLIENT_ID: "${{ secrets.AZURE_CLIENT_ID }}"
AZURE_TENANT_ID: "${{ secrets.AZURE_TENANT_ID }}"
AZURE_SUBSCRIPTION_ID: "${{ secrets.AZURE_SUBSCRIPTION_ID }}"
TF_MODULES_SSH_DEPLOY_KEY: ${{ secrets.TF_MODULES_SSH_DEPLOY_KEY }}
TF_MODULES_SSH_DEPLOY_KEY: ${{ secrets.TF_MODULES_SSH_DEPLOY_KEY }}
31 changes: 31 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.92.0
hooks:
- id: terraform_fmt
args:
- --args=--recursive
- id: terraform_tflint
args:
- --args=--recursive
- --args=--disable-rule terraform_required_version --disable-rule terraform_required_providers
- id: terraform_validate
args:
- --hook-config=--retry-once-with-cleanup=true
- --tf-init-args=--backend=false
- repo: https://github.com/zricethezav/gitleaks
rev: v8.18.4
hooks:
- id: gitleaks
- repo: https://github.com/psf/black
rev: 24.4.2
hooks:
- id: black
2 changes: 1 addition & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @UKHSA-Internal/devops-cloud-engineering-team
* @UKHSA-Internal/devops-cloud-engineering-team
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@
*This repository establishes a foundational Terraform file and folder structure, encompassing configurations for multiple applications and core services. Each component is equipped with environment-specific variable files, facilitating adaptability and scalability across diverse deployment stages. The architecture is meticulously crafted to foster modularity, maintainability, and effective resource management.*

For further details on DevOps standards, please refer to the [DevOps Standards Documentation](https://confluence.collab.test-and-trace.nhs.uk/display/DOE/Standards).

### Pre-commit hooks

A pre-commit hooks config is included in the repo. This can be installed by running the below command inside of the repository directory after cloning:

```pre-commit install```
1 change: 0 additions & 1 deletion applications/example-application-1/locals.tf
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

1 change: 0 additions & 1 deletion applications/example-application-1/main.tf
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

1 change: 0 additions & 1 deletion applications/example-application-1/tfvars/dev.tfvars
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

1 change: 0 additions & 1 deletion applications/example-application-1/tfvars/prd.tfvars
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

1 change: 0 additions & 1 deletion applications/example-application-1/tfvars/qat.tfvars
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

1 change: 0 additions & 1 deletion applications/example-application-1/variables.tf
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

1 change: 0 additions & 1 deletion applications/example-application-2/locals.tf
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

1 change: 0 additions & 1 deletion applications/example-application-2/main.tf
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

1 change: 0 additions & 1 deletion applications/example-application-2/tfvars/dev.tfvars
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

1 change: 0 additions & 1 deletion applications/example-application-2/tfvars/prd.tfvars
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

1 change: 0 additions & 1 deletion applications/example-application-2/tfvars/qat.tfvars
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

1 change: 0 additions & 1 deletion applications/example-application-2/variables.tf
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

1 change: 0 additions & 1 deletion core-services/example-service-1/locals.tf
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

1 change: 0 additions & 1 deletion core-services/example-service-1/main.tf
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

1 change: 0 additions & 1 deletion core-services/example-service-1/tfvars/dev.tfvars
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

1 change: 0 additions & 1 deletion core-services/example-service-1/tfvars/prd.tfvars
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

1 change: 0 additions & 1 deletion core-services/example-service-1/tfvars/qat.tfvars
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

1 change: 0 additions & 1 deletion core-services/example-service-1/variables.tf
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

1 change: 0 additions & 1 deletion core-services/example-service-2/locals.tf
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

1 change: 0 additions & 1 deletion core-services/example-service-2/main.tf
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

1 change: 0 additions & 1 deletion core-services/example-service-2/tfvars/dev.tfvars
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

1 change: 0 additions & 1 deletion core-services/example-service-2/tfvars/prd.tfvars
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

1 change: 0 additions & 1 deletion core-services/example-service-2/tfvars/qat.tfvars
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

1 change: 0 additions & 1 deletion core-services/example-service-2/variables.tf
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

1 change: 0 additions & 1 deletion environment/dev.tfvars
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

1 change: 0 additions & 1 deletion environment/prd.tfvars
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

1 change: 0 additions & 1 deletion environment/qat.tfvars
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

1 change: 0 additions & 1 deletion global.tfvars
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

0 comments on commit 7bc419b

Please sign in to comment.