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

Lines changed: 14 additions & 0 deletions
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

Lines changed: 5 additions & 0 deletions
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

Lines changed: 11 additions & 0 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 3 additions & 3 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 4 additions & 4 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 6 additions & 6 deletions
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
}

0 commit comments

Comments
 (0)