Skip to content

Commit 6aedd9a

Browse files
Add pre-commit config to run terraform fmt
Run the hook to format all the code and enforce this via CI to avoid regressions. This is to keep formatting consistent and not a thing to worry/think about when developing or in PRs
1 parent bfdfc80 commit 6aedd9a

38 files changed

+183
-153
lines changed

.github/workflows/pr.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Checks
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
8+
jobs
9+
lint:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: hashicorp/setup-terraform@v3
14+
- uses: pre-commit/action@v3

.pre-commit-config.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
repos:
2+
- repo: https://github.com/antonbabenko/pre-commit-terraform
3+
rev: v1.86.0
4+
hooks:
5+
- id: terraform_fmt

CONTRIBUTING.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## Linting
2+
3+
Linting is handled via `pre-commit`. Follow the [install
4+
instructions](https://pre-commit.com/#install), and additionally [install
5+
Terraform](https://developer.hashicorp.com/terraform/install) then install and
6+
run the hooks:
7+
8+
``` console
9+
$ pre-commit install
10+
$ pre-commit run --all-hooks
11+
```

dev-aws/finance/debt.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ resource "kafka_topic" "account-debt-events" {
4141
}
4242

4343
resource "kafka_topic" "debt-collection-events" {
44-
name = "debt-collection.events"
44+
name = "debt-collection.events"
4545
replication_factor = 3
4646
partitions = 3
4747
config = {

dev-aws/finance/direct-debits.tf

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ resource "kafka_topic" "dd_run_reconciliation_events" {
1515
partitions = 10
1616
config = {
1717
"max.message.bytes" = "1048576"
18-
"retention.bytes" = "-1"
19-
"retention.ms" = "259200000" #3 days, maybe worth doing it less
20-
"cleanup.policy" = "delete"
18+
"retention.bytes" = "-1"
19+
"retention.ms" = "259200000" #3 days, maybe worth doing it less
20+
"cleanup.policy" = "delete"
2121
}
2222
}
2323

dev-aws/finance/disputes-fabricator.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ resource "kafka_topic" "comms-eqdb-loader-events" {
1010
}
1111

1212
resource "kafka_topic" "disputes-diffs-events" {
13-
name = "disputes-diffs.events"
13+
name = "disputes-diffs.events"
1414
replication_factor = 3
1515
partitions = 10
1616
config = {

dev-aws/kafka-shared/customer-billing.tf

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ resource "kafka_topic" "invoice_fulfillment" {
22
name = "bex.internal.bill_fulfilled"
33
replication_factor = 3
44
partitions = 10
5-
config = {
5+
config = {
66
# keep data for 7 days
7-
"retention.ms" = "604800000"
7+
"retention.ms" = "604800000"
88
# allow max 1 MB for a message
99
"max.message.bytes" = "1048576"
1010
"compression.type" = "zstd"
@@ -16,9 +16,9 @@ resource "kafka_topic" "invoice_fulfillment_deadletter" {
1616
name = "bex.internal.accountreadytobefulfilled_deadletter"
1717
replication_factor = 3
1818
partitions = 10
19-
config = {
19+
config = {
2020
# keep data for 14 days
21-
"retention.ms" = "1209600000"
21+
"retention.ms" = "1209600000"
2222
# allow max 1 MB for a message
2323
"max.message.bytes" = "1048576"
2424
"compression.type" = "zstd"

dev-aws/kafka-shared/iam_cerbos-audit.tf

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ resource "kafka_topic" "iam_cerbos_audit_v1" {
99
"retention.ms" = "172800000"
1010
# allow max 1 MB for a message
1111
"max.message.bytes" = "1048576"
12-
"compression.type" = "zstd"
13-
"cleanup.policy" = "delete"
12+
"compression.type" = "zstd"
13+
"cleanup.policy" = "delete"
1414
}
1515
}
1616

dev-aws/kafka-shared/iam_identitydb.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ resource "kafka_topic" "iam_identitydb_v1" {
22
name = "auth.iam-identitydb-v1"
33
replication_factor = 3
44
# MUST be 1 partition as identitydb assumes this to be true
5-
partitions = 1
5+
partitions = 1
66
config = {
77
# retain 100MB on each partition
88
"retention.bytes" = "104857600"

dev-aws/kafka-shared/kafka-ui.tf

+6-6
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ resource "kafka_acl" "kafka_ui_group" {
1717
}
1818

1919
resource "kafka_acl" "kafka_ui_cluster" {
20-
resource_name = "kafka-cluster"
21-
resource_type = "Cluster"
22-
acl_principal = "User:CN=pubsub/kafka-ui"
23-
acl_host = "*"
24-
acl_operation = "All"
25-
acl_permission_type = "Allow"
20+
resource_name = "kafka-cluster"
21+
resource_type = "Cluster"
22+
acl_principal = "User:CN=pubsub/kafka-ui"
23+
acl_host = "*"
24+
acl_operation = "All"
25+
acl_permission_type = "Allow"
2626
resource_pattern_type_filter = "Literal"
2727
}

dev-aws/kafka-shared/mirror-maker.tf

+6-6
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ resource "kafka_acl" "mirror_maker_group_access" {
1717
}
1818

1919
resource "kafka_acl" "mirror_maker_cluster_access" {
20-
resource_name = "kafka-cluster"
21-
resource_type = "Cluster"
22-
acl_principal = "User:CN=pubsub/mirror-maker"
23-
acl_host = "*"
24-
acl_operation = "All"
25-
acl_permission_type = "Allow"
20+
resource_name = "kafka-cluster"
21+
resource_type = "Cluster"
22+
acl_principal = "User:CN=pubsub/mirror-maker"
23+
acl_host = "*"
24+
acl_operation = "All"
25+
acl_permission_type = "Allow"
2626
resource_pattern_type_filter = "Literal"
2727
}

dev-aws/kafka-shared/otel.tf

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ resource "kafka_acl" "otel_collector_topic_otlp_spans_access" {
2828
}
2929

3030
resource "kafka_quota" "otel_collector_producer_quota" {
31-
entity_name = "User:CN=otel/collector"
32-
entity_type = "user"
31+
entity_name = "User:CN=otel/collector"
32+
entity_type = "user"
3333
config = {
3434
# limit producing to 5 MB/s
3535
"producer_byte_rate" = "5242880"
@@ -57,8 +57,8 @@ resource "kafka_acl" "tempo_distributor_group_processor_tempo_access" {
5757
}
5858

5959
resource "kafka_quota" "tempo_distributor_consumer_quota" {
60-
entity_name = "User:CN=otel/tempo-distributor"
61-
entity_type = "user"
60+
entity_name = "User:CN=otel/tempo-distributor"
61+
entity_type = "user"
6262
config = {
6363
# limit consuming to 5 MB/s
6464
"consumer_byte_rate" = "5242880"

dev-aws/kafka-shared/pubsub-examples.tf

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ resource "kafka_topic" "pubsub_examples" {
22
name = "dev-enablement.pubsub-examples"
33
replication_factor = 3
44
partitions = 10
5-
config = {
5+
config = {
66
# retain 100MB on each partition
7-
"retention.bytes" = "104857600"
7+
"retention.bytes" = "104857600"
88
# keep data for 2 days
9-
"retention.ms" = "172800000"
9+
"retention.ms" = "172800000"
1010
# allow max 1 MB for a message
1111
"max.message.bytes" = "1048576"
1212
"compression.type" = "zstd"

dev-merit/kafka-shared/iam.tf

+8-8
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ resource "kafka_topic" "iam_cerbos_audit_v1" {
99
"retention.ms" = "172800000"
1010
# allow max 1 MB for a message
1111
"max.message.bytes" = "1048576"
12-
"compression.type" = "zstd"
13-
"cleanup.policy" = "delete"
12+
"compression.type" = "zstd"
13+
"cleanup.policy" = "delete"
1414
}
1515
}
1616

@@ -24,8 +24,8 @@ resource "kafka_acl" "iam_cerbos_audit_v1_access" {
2424
}
2525

2626
resource "kafka_quota" "iam_cerbos_audit_v1_quota" {
27-
entity_name = "User:CN=auth/policy-decision-point"
28-
entity_type = "user"
27+
entity_name = "User:CN=auth/policy-decision-point"
28+
entity_type = "user"
2929
config = {
3030
# limit producing to 5 MB/s
3131
"producer_byte_rate" = "5242880"
@@ -53,8 +53,8 @@ resource "kafka_acl" "indexer_iam_cerbos_audit_v1_group_access" {
5353
}
5454

5555
resource "kafka_quota" "indexer_iam_cerbos_audit_v1_quota" {
56-
entity_name = "User:CN=auth/iam-cerbos-audit-v1-indexer"
57-
entity_type = "user"
56+
entity_name = "User:CN=auth/iam-cerbos-audit-v1-indexer"
57+
entity_type = "user"
5858
config = {
5959
# limit consuming to 5 MB/s
6060
"consumer_byte_rate" = "5242880"
@@ -82,8 +82,8 @@ resource "kafka_acl" "exporter_iam_cerbos_audit_v1_group_access" {
8282
}
8383

8484
resource "kafka_quota" "exporter_iam_cerbos_audit_v1_quota" {
85-
entity_name = "User:CN=auth/iam-cerbos-audit-v1-exporter"
86-
entity_type = "user"
85+
entity_name = "User:CN=auth/iam-cerbos-audit-v1-exporter"
86+
entity_type = "user"
8787
config = {
8888
# limit consuming to 5 MB/s
8989
"consumer_byte_rate" = "5242880"

dev-merit/kafka-shared/kafka-ui.tf

+6-6
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ resource "kafka_acl" "kafka_ui_group" {
1717
}
1818

1919
resource "kafka_acl" "kafka_ui_cluster" {
20-
resource_name = "kafka-cluster"
21-
resource_type = "Cluster"
22-
acl_principal = "User:CN=pubsub/kafka-ui"
23-
acl_host = "*"
24-
acl_operation = "All"
25-
acl_permission_type = "Allow"
20+
resource_name = "kafka-cluster"
21+
resource_type = "Cluster"
22+
acl_principal = "User:CN=pubsub/kafka-ui"
23+
acl_host = "*"
24+
acl_operation = "All"
25+
acl_permission_type = "Allow"
2626
resource_pattern_type_filter = "Literal"
2727
}

dev-merit/kafka-shared/mirror-maker.tf

+6-6
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ resource "kafka_acl" "mirror_maker_group_access" {
1717
}
1818

1919
resource "kafka_acl" "mirror_maker_cluster_access" {
20-
resource_name = "kafka-cluster"
21-
resource_type = "Cluster"
22-
acl_principal = "User:CN=pubsub/mirror-maker"
23-
acl_host = "*"
24-
acl_operation = "All"
25-
acl_permission_type = "Allow"
20+
resource_name = "kafka-cluster"
21+
resource_type = "Cluster"
22+
acl_principal = "User:CN=pubsub/mirror-maker"
23+
acl_host = "*"
24+
acl_operation = "All"
25+
acl_permission_type = "Allow"
2626
resource_pattern_type_filter = "Literal"
2727
}

dev-merit/kafka-shared/otel.tf

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ resource "kafka_acl" "otel_collector_topic_otlp_spans_access" {
2828
}
2929

3030
resource "kafka_quota" "otel_collector_producer_quota" {
31-
entity_name = "User:CN=otel/collector"
32-
entity_type = "user"
31+
entity_name = "User:CN=otel/collector"
32+
entity_type = "user"
3333
config = {
3434
# limit producing to 5 MB/s
3535
"producer_byte_rate" = "5242880"
@@ -57,8 +57,8 @@ resource "kafka_acl" "tempo_distributor_group_processor_tempo_access" {
5757
}
5858

5959
resource "kafka_quota" "tempo_distributor_consumer_quota" {
60-
entity_name = "User:CN=otel/tempo-distributor"
61-
entity_type = "user"
60+
entity_name = "User:CN=otel/tempo-distributor"
61+
entity_type = "user"
6262
config = {
6363
# limit consuming to 5 MB/s
6464
"consumer_byte_rate" = "5242880"

dev-merit/kafka-shared/pubsub-examples.tf

+10-10
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ resource "kafka_topic" "pubsub_examples" {
99
"retention.ms" = "172800000"
1010
# allow max 1 MB for a message
1111
"max.message.bytes" = "1048576"
12-
"compression.type" = "zstd"
13-
"cleanup.policy" = "delete"
12+
"compression.type" = "zstd"
13+
"cleanup.policy" = "delete"
1414
}
1515
}
1616

@@ -24,8 +24,8 @@ resource "kafka_acl" "example_producer_topic_access" {
2424
}
2525

2626
resource "kafka_quota" "example_producer_quota" {
27-
entity_name = "User:CN=dev-enablement/example-producer"
28-
entity_type = "user"
27+
entity_name = "User:CN=dev-enablement/example-producer"
28+
entity_type = "user"
2929
config = {
3030
# limit producing to 5 MB/s
3131
"producer_byte_rate" = "5242880"
@@ -54,8 +54,8 @@ resource "kafka_acl" "example_consume_process_individually_group_access" {
5454
}
5555

5656
resource "kafka_quota" "example_consume_process_individually_quota" {
57-
entity_name = "User:CN=dev-enablement/example-consume-process-individually"
58-
entity_type = "user"
57+
entity_name = "User:CN=dev-enablement/example-consume-process-individually"
58+
entity_type = "user"
5959
config = {
6060
# limit consuming to 5 MB/s
6161
"consumer_byte_rate" = "5242880"
@@ -84,8 +84,8 @@ resource "kafka_acl" "example_consume_process_batch_group_access" {
8484
}
8585

8686
resource "kafka_quota" "example_consume_process_batch_quota" {
87-
entity_name = "User:CN=dev-enablement/example-consume-process-batch"
88-
entity_type = "user"
87+
entity_name = "User:CN=dev-enablement/example-consume-process-batch"
88+
entity_type = "user"
8989
config = {
9090
# limit consuming to 5 MB/s
9191
"consumer_byte_rate" = "5242880"
@@ -114,8 +114,8 @@ resource "kafka_acl" "pubsub_es_topic_indexer_group_access" {
114114
}
115115

116116
resource "kafka_quota" "pubsub_es_topic_indexer_quota" {
117-
entity_name = "User:CN=dev-enablement/es-topic-indexer"
118-
entity_type = "user"
117+
entity_name = "User:CN=dev-enablement/es-topic-indexer"
118+
entity_type = "user"
119119
config = {
120120
# limit consuming to 5 MB/s
121121
"consumer_byte_rate" = "5242880"

exp-1-merit/kafka-shared/kafka-ui.tf

+6-6
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ resource "kafka_acl" "kafka_ui_group" {
1717
}
1818

1919
resource "kafka_acl" "kafka_ui_cluster" {
20-
resource_name = "kafka-cluster"
21-
resource_type = "Cluster"
22-
acl_principal = "User:CN=pubsub/kafka-ui"
23-
acl_host = "*"
24-
acl_operation = "All"
25-
acl_permission_type = "Allow"
20+
resource_name = "kafka-cluster"
21+
resource_type = "Cluster"
22+
acl_principal = "User:CN=pubsub/kafka-ui"
23+
acl_host = "*"
24+
acl_operation = "All"
25+
acl_permission_type = "Allow"
2626
resource_pattern_type_filter = "Literal"
2727
}

exp-1-merit/kafka-shared/pubsub-examples.tf

+6-6
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ resource "kafka_topic" "pubsub_examples" {
99
"retention.ms" = "172800000"
1010
# allow max 1 MB for a message
1111
"max.message.bytes" = "1048576"
12-
"compression.type" = "zstd"
13-
"cleanup.policy" = "delete"
12+
"compression.type" = "zstd"
13+
"cleanup.policy" = "delete"
1414
}
1515
}
1616

@@ -24,8 +24,8 @@ resource "kafka_acl" "example_producer_topic_access" {
2424
}
2525

2626
resource "kafka_quota" "example_producer_quota" {
27-
entity_name = "User:CN=pubsub/example-producer"
28-
entity_type = "user"
27+
entity_name = "User:CN=pubsub/example-producer"
28+
entity_type = "user"
2929
config = {
3030
# limit producing to 5 MB/s
3131
"producer_byte_rate" = "5242880"
@@ -53,8 +53,8 @@ resource "kafka_acl" "example_consume_process_individually_group_access" {
5353
}
5454

5555
resource "kafka_quota" "example_consume_process_individually_quota" {
56-
entity_name = "User:CN=pubsub/example-consume-process-individually"
57-
entity_type = "user"
56+
entity_name = "User:CN=pubsub/example-consume-process-individually"
57+
entity_type = "user"
5858
config = {
5959
# limit consuming to 5 MB/s
6060
"consumer_byte_rate" = "5242880"

0 commit comments

Comments
 (0)