diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6ffdb948..3049ea6b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -60,3 +60,7 @@ repos: hooks: - id: pip-audit args: ["--require-hashes", "--requirement", "requirements/local.txt"] + - repo: https://github.com/antonbabenko/pre-commit-terraform + rev: "v1.77.0" + hooks: + - id: terraform_fmt diff --git a/{{cookiecutter.project_dirname}}/.pre-commit-config.yaml b/{{cookiecutter.project_dirname}}/.pre-commit-config.yaml new file mode 100644 index 00000000..4543e9bd --- /dev/null +++ b/{{cookiecutter.project_dirname}}/.pre-commit-config.yaml @@ -0,0 +1,25 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: "v4.4.0" + hooks: + - id: check-added-large-files + args: ["--maxkb=1024"] + - id: check-case-conflict + - id: check-json + - id: check-merge-conflict + - id: check-yaml + args: ["--allow-multiple-documents"] + - id: detect-private-key + exclude: ^traefik\/localhost\/key.pem$ + - id: end-of-file-fixer + - id: fix-byte-order-marker + - id: mixed-line-ending + - id: trailing-whitespace + - repo: https://github.com/antonbabenko/pre-commit-terraform + rev: "v1.77.0" + hooks: + - id: terraform_fmt + - repo: https://github.com/pre-commit/mirrors-prettier + rev: "v3.0.0-alpha.4" + hooks: + - id: prettier diff --git a/{{cookiecutter.project_dirname}}/Makefile b/{{cookiecutter.project_dirname}}/Makefile index 134b62a7..4e4b58c8 100644 --- a/{{cookiecutter.project_dirname}}/Makefile +++ b/{{cookiecutter.project_dirname}}/Makefile @@ -6,6 +6,14 @@ p = shell django_shell: ## Exec django command docker exec -it $(c) python manage.py $(p) +.PHONY: precommit +precommit: ## Fix code formatting, linting and sorting imports + python3 -m pre_commit run --all-files + +.PHONY: precommit_update +precommit_update: ## Update pre_commit + python3 -m pre_commit autoupdate + .PHONY: pull pull: ## Pull develop on all services git checkout main && git pull && \{% if cookiecutter.backend_type != 'none' %} diff --git a/{{cookiecutter.project_dirname}}/terraform/cluster/modules/kubernetes/metrics/main.tf b/{{cookiecutter.project_dirname}}/terraform/cluster/modules/kubernetes/metrics/main.tf index 7466236b..03bd2116 100644 --- a/{{cookiecutter.project_dirname}}/terraform/cluster/modules/kubernetes/metrics/main.tf +++ b/{{cookiecutter.project_dirname}}/terraform/cluster/modules/kubernetes/metrics/main.tf @@ -10,12 +10,12 @@ terraform { /* Metrics Server */ resource "helm_release" "metrics_server" { - name = "metrics-server" - namespace = "metrics-server" - repository = "https://kubernetes-sigs.github.io/metrics-server" - chart = "metrics-server" - create_namespace = true - version = "3.8.2" + name = "metrics-server" + namespace = "metrics-server" + repository = "https://kubernetes-sigs.github.io/metrics-server" + chart = "metrics-server" + create_namespace = true + version = "3.8.2" values = [file("${path.module}/metrics-server/values.yaml")] } diff --git a/{{cookiecutter.project_dirname}}/terraform/environment/digitalocean-k8s/main.tf b/{{cookiecutter.project_dirname}}/terraform/environment/digitalocean-k8s/main.tf index 11036ac1..1ab3fa78 100644 --- a/{{cookiecutter.project_dirname}}/terraform/environment/digitalocean-k8s/main.tf +++ b/{{cookiecutter.project_dirname}}/terraform/environment/digitalocean-k8s/main.tf @@ -167,11 +167,11 @@ module "monitoring" { grafana_user = var.grafana_user grafana_version = var.grafana_version - s3_region = var.s3_region - s3_access_id = var.s3_access_id - s3_secret_key = var.s3_secret_key - s3_bucket_name = local.s3_bucket_name - s3_host = local.s3_host + s3_region = var.s3_region + s3_access_id = var.s3_access_id + s3_secret_key = var.s3_secret_key + s3_bucket_name = local.s3_bucket_name + s3_host = local.s3_host } /* Routing */ diff --git a/{{cookiecutter.project_dirname}}/terraform/environment/modules/kubernetes/monitoring/loki/values.yaml b/{{cookiecutter.project_dirname}}/terraform/environment/modules/kubernetes/monitoring/loki/values.yaml index 69d87542..1c4b1512 100644 --- a/{{cookiecutter.project_dirname}}/terraform/environment/modules/kubernetes/monitoring/loki/values.yaml +++ b/{{cookiecutter.project_dirname}}/terraform/environment/modules/kubernetes/monitoring/loki/values.yaml @@ -5,12 +5,12 @@ loki: enabled: true config: chunk_store_config: - max_look_back_period: "4400h" + max_look_back_period: "4400h" table_manager: - retention_deletes_enabled: true - retention_period: "4400h" + retention_deletes_enabled: true + retention_period: "4400h" limits_config: - max_query_length: "2200h" + max_query_length: "2200h" promtail: enabled: true diff --git a/{{cookiecutter.project_dirname}}/terraform/environment/modules/kubernetes/monitoring/main.tf b/{{cookiecutter.project_dirname}}/terraform/environment/modules/kubernetes/monitoring/main.tf index 6115c927..87b7c2e1 100644 --- a/{{cookiecutter.project_dirname}}/terraform/environment/modules/kubernetes/monitoring/main.tf +++ b/{{cookiecutter.project_dirname}}/terraform/environment/modules/kubernetes/monitoring/main.tf @@ -48,11 +48,11 @@ resource "helm_release" "loki" { dynamic "set" { for_each = local.s3_storage_enabled ? { - "loki.config.storage_config.aws.access_key_id" = var.s3_access_id - "loki.config.storage_config.aws.bucketnames" = var.s3_bucket_name - "loki.config.storage_config.aws.endpoint" = var.s3_host - "loki.config.storage_config.aws.region" = var.s3_region - "loki.config.storage_config.aws.secret_access_key" = var.s3_secret_key + "loki.config.storage_config.aws.access_key_id" = var.s3_access_id + "loki.config.storage_config.aws.bucketnames" = var.s3_bucket_name + "loki.config.storage_config.aws.endpoint" = var.s3_host + "loki.config.storage_config.aws.region" = var.s3_region + "loki.config.storage_config.aws.secret_access_key" = var.s3_secret_key } : {} content { name = set.key diff --git a/{{cookiecutter.project_dirname}}/terraform/environment/other-k8s/main.tf b/{{cookiecutter.project_dirname}}/terraform/environment/other-k8s/main.tf index e60cca44..3e4650b1 100644 --- a/{{cookiecutter.project_dirname}}/terraform/environment/other-k8s/main.tf +++ b/{{cookiecutter.project_dirname}}/terraform/environment/other-k8s/main.tf @@ -93,11 +93,11 @@ module "monitoring" { grafana_user = var.grafana_user grafana_version = var.grafana_version - s3_region = var.s3_region - s3_access_id = var.s3_access_id - s3_secret_key = var.s3_secret_key - s3_bucket_name = var.s3_bucket_name - s3_host = var.s3_host + s3_region = var.s3_region + s3_access_id = var.s3_access_id + s3_secret_key = var.s3_secret_key + s3_bucket_name = var.s3_bucket_name + s3_host = var.s3_host } /* Routing */