Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/687 Add pre commit terraform #229

Merged
merged 2 commits into from
Feb 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
25 changes: 25 additions & 0 deletions {{cookiecutter.project_dirname}}/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions {{cookiecutter.project_dirname}}/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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' %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down