Skip to content

Commit dadec5d

Browse files
committed
chore: adding files to modules
chore: adding files to modules chore: adding files to modules chore: adding files to modules chore: adding files to modules chore: adding files to modules chore: adding files to modules chore: adding files to modules
1 parent 3577e5c commit dadec5d

File tree

25 files changed

+150
-55
lines changed

25 files changed

+150
-55
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ repos:
33
hooks:
44
- id: check-terraform-structure
55
name: Check Terraform module structure
6-
entry: bash ci/check_tf_structure.sh
6+
entry: bash ci/check_tf_structure.sh modules/**/{backplane,buildingblock}
77
language: system
88
pass_filenames: false
99
- repo: local
@@ -23,9 +23,11 @@ repos:
2323
- id: terraform_fmt
2424
- id: terragrunt_fmt
2525
- id: terraform_validate
26+
exclude:
27+
#some of the validation have to be excluded because the provider.tf cant be validated
28+
^modules/(github/repository|aks/(github-connector|postgresql))/buildingblock/
29+
2630
- repo: https://github.com/pre-commit/pre-commit-hooks
2731
rev: v4.4.0 # Use the ref you want to point at
2832
hooks:
2933
- id: trailing-whitespace
30-
exclude: "^compliance/"
31-

check_tf_structure.sh

Lines changed: 0 additions & 25 deletions
This file was deleted.

ci/check_tf_structure.sh

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,42 @@
11
#!/bin/bash
2-
32
set -e
43

54
warnings=()
6-
recommended_tf_files=("main.tf" "variables.tf" "outputs.tf" "provider.tf" "versions.tf")
75

8-
# Nur Verzeichnisse prüfen, in denen mindestens eine .tf-Datei liegt
9-
for buildingblock_path in $(find . -type f -name "*.tf" -exec dirname {} \; | sort -u); do
10-
for tf_file in "${recommended_tf_files[@]}"; do
11-
if [[ ! -f "$buildingblock_path/$tf_file" ]]; then
12-
warnings+=("⚠️ '$tf_file' fehlt in $buildingblock_path")
6+
# Required Terraform files
7+
common_tf_files=("main.tf" "variables.tf" "outputs.tf" "provider.tf" "versions.tf")
8+
readme_file="APP_TEAM_README.md"
9+
10+
# Find relevant module directories
11+
mapfile -t paths_to_check < <(find modules/ -type d \( -path "*/buildingblock" -o -path "*/backplane" \))
12+
13+
if [ "${#paths_to_check[@]}" -eq 0 ]; then
14+
echo "❌ No Terraform module folders found."
15+
exit 1
16+
fi
17+
18+
# Check each directory silently unless a file is missing
19+
for path in "${paths_to_check[@]}"; do
20+
for tf_file in "${common_tf_files[@]}"; do
21+
if [[ ! -f "$path/$tf_file" ]]; then
22+
warnings+=("⚠️ '$tf_file' is missing in $path")
1323
fi
1424
done
25+
26+
if [[ "$(basename "$path")" == "buildingblock" ]]; then
27+
if [[ ! -f "$path/$readme_file" ]]; then
28+
warnings+=("⚠️ '$readme_file' is missing in $path")
29+
fi
30+
fi
1531
done
1632

17-
# Ausgabe & Exit-Code
33+
# Output only if something's wrong
1834
if [ "${#warnings[@]}" -gt 0 ]; then
35+
echo "❌ Issues detected:"
1936
for warn in "${warnings[@]}"; do
2037
echo "$warn"
2138
done
2239
exit 1
2340
else
24-
echo "✅ Alle empfohlenen Terraform-Dateien sind vorhanden."
41+
exit 0
2542
fi

modules/aks/github-connector/backplane/outputs.tf

Whitespace-only changes.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
provider "azurerm" {
2+
features {}
3+
}
4+
5+
provider "azuread" {}
6+
7+
provider "kubernetes" {}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
provider "azurerm" {
2+
features {}
3+
}
4+
5+
provider "azuread" {}
6+
7+
provider "kubernetes" {}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
provider "azurerm" {
2+
features {}
3+
}
4+
5+
provider "azuread" {}
6+
7+
provider "kubernetes" {}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
provider "aws" {
2+
alias = "management"
3+
}
4+
5+
provider "aws" {
6+
alias = "backplane"
7+
}

modules/aws/s3_bucket/backplane/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ No modules.
3434

3535
## Inputs
3636

37-
No inputs.
37+
| Name | Description | Type | Default | Required |
38+
|------|-------------|------|---------|:--------:|
39+
| <a name="input_aws_s3_iam_user"></a> [aws\_s3\_iam\_user](#input\_aws\_s3\_iam\_user) | The IAM user to use for the S3 bucket | `string` | `"buildingblock-s3-user"` | no |
40+
| <a name="input_location"></a> [location](#input\_location) | The location of the S3 bucket | `string` | n/a | yes |
3841

3942
## Outputs
4043

modules/aws/s3_bucket/backplane/iam.tf renamed to modules/aws/s3_bucket/backplane/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
data "aws_caller_identity" "current" {}
22

33
resource "aws_iam_user" "buildingblock_s3_user" {
4-
name = "buildingblock-s3-user"
4+
name = var.aws_s3_iam_user
55
}
66

77
data "aws_iam_policy_document" "s3_full_access" {

0 commit comments

Comments
 (0)