Skip to content

Commit 275b7f9

Browse files
committed
Initial AWS modules setup
1 parent 3798ac1 commit 275b7f9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+4070
-1
lines changed

.github/release-drafter.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name-template: '$RESOLVED_VERSION'
2+
tag-template: '$RESOLVED_VERSION'
3+
template: |
4+
## What's Changed
5+
$CHANGES
6+
7+
## Contributors
8+
$CONTRIBUTORS
9+
10+
**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...$RESOLVED_VERSION
11+
change-template: '- $TITLE by @$AUTHOR in #$NUMBER'

.github/scripts/generate-docs.sh

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# Determine repo root path relative to this script
5+
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
6+
7+
# Path to terraform-docs config
8+
TFDOCS_CONFIG="${REPO_ROOT}/.terraform-docs.yml"
9+
10+
# Check terraform-docs is installed
11+
if ! command -v terraform-docs &> /dev/null; then
12+
echo "❌ terraform-docs is not installed. Install it from https://terraform-docs.io/"
13+
exit 1
14+
fi
15+
16+
echo "📘 Generating module documentation using config at: $TFDOCS_CONFIG"
17+
echo
18+
19+
# Dynamically find all directories that contain a 'modules' subdirectory
20+
echo "🔍 Discovering module directories..."
21+
MODULE_DIRS=()
22+
while IFS= read -r -d '' modules_dir; do
23+
MODULE_DIRS+=("$modules_dir")
24+
done < <(find "$REPO_ROOT" -maxdepth 2 -type d -name "modules" -print0)
25+
26+
if [[ ${#MODULE_DIRS[@]} -eq 0 ]]; then
27+
echo "⚠️ No 'modules' directories found in the repository"
28+
exit 1
29+
fi
30+
31+
echo "📁 Found module directories:"
32+
for dir in "${MODULE_DIRS[@]}"; do
33+
echo " ${dir#$REPO_ROOT/}"
34+
done
35+
echo
36+
37+
# Loop through each discovered module directory
38+
for MODULE_BASE_DIR in "${MODULE_DIRS[@]}"; do
39+
echo "🔍 Searching for modules in: ${MODULE_BASE_DIR#$REPO_ROOT/}"
40+
41+
# Find all modules with variables.tf in this directory
42+
MODULES_FOUND=false
43+
find "$MODULE_BASE_DIR" -type f -name "variables.tf" | while read -r tf_file; do
44+
MODULE_DIR="$(dirname "$tf_file")"
45+
echo "📄 Updating docs for module: ${MODULE_DIR#$REPO_ROOT/}"
46+
MODULES_FOUND=true
47+
48+
terraform-docs --config "$TFDOCS_CONFIG" "$MODULE_DIR" > "$MODULE_DIR/README.md"
49+
done
50+
51+
# Check if any modules were found in this directory
52+
if ! find "$MODULE_BASE_DIR" -type f -name "variables.tf" -print -quit | grep -q .; then
53+
echo " ℹ️ No modules with variables.tf found in ${MODULE_BASE_DIR#$REPO_ROOT/}"
54+
fi
55+
echo
56+
done
57+
58+
echo "✅ Documentation generated for all modules."

.github/workflows/lint.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Lint and Test
2+
3+
on:
4+
pull_request:
5+
branches: [ main ]
6+
7+
jobs:
8+
lint:
9+
name: Lint
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- uses: hashicorp/setup-terraform@v3
15+
with:
16+
terraform_version: "1.7.0"
17+
18+
- name: Terraform Format Check
19+
run: terraform fmt -check -recursive
20+
21+
- uses: terraform-linters/setup-tflint@v4
22+
with:
23+
tflint_version: v0.50.0
24+
25+
- name: TFLint
26+
run: |
27+
tflint --init
28+
tflint --recursive --format compact
29+
30+
validate:
31+
name: Validate
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v4
35+
36+
- uses: hashicorp/setup-terraform@v3
37+
with:
38+
terraform_version: "1.7.0"
39+
40+
- name: Terraform Init
41+
run: |
42+
cd examples/simple
43+
terraform init -backend=false
44+
45+
- name: Terraform Validate
46+
run: |
47+
cd examples/simple
48+
terraform validate

.github/workflows/release.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Create Release on Latest Tag Push
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Create Release
16+
uses: release-drafter/release-drafter@b1476f6e6eb133afa41ed8589daba6dc69b4d3f5 # v6 release-drafter
17+
with:
18+
name: ${{ github.ref_name }}
19+
tag: ${{ github.ref_name }}
20+
publish: true
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Local .terraform directories
2+
**/.terraform/*
3+
4+
# .tfstate files
5+
*.tfstate
6+
*.tfstate.*
7+
8+
# Crash log files
9+
crash.log
10+
crash.*.log
11+
12+
# Exclude all .tfvars files, which are likely to contain sensitive data
13+
*.tfvars
14+
*.tfvars.json
15+
16+
# Ignore override files as they are usually used for local development
17+
override.tf
18+
override.tf.json
19+
*_override.tf
20+
*_override.tf.json
21+
22+
# Ignore CLI configuration files
23+
.terraformrc
24+
terraform.rc
25+
26+
# Ignore lock files for examples and tests
27+
examples/*/.terraform.lock.hcl
28+
tests/.terraform.lock.hcl
29+
30+
# macOS
31+
.DS_Store
32+
33+
# IDE
34+
.idea/
35+
.vscode/
36+
37+
# Local development
38+
*.env
39+
.envrc
40+
*.bak

.terraform-docs.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
formatter: markdown
2+
3+
output-file: README.md
4+
output-mode: inject
5+
sections:
6+
show-header: true
7+
show-inputs: true
8+
show-outputs: true
9+
show-providers: false
10+
show-requirements: false
11+
show-resources: false
12+
show-data-sources: false

CONTRIBUTING.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Contributing to materialize-terraform-self-managed
2+
3+
We love your input! We want to make contributing to materialize-terraform-self-managed as easy and transparent as possible, whether it's:
4+
5+
- Reporting a bug
6+
- Discussing the current state of the code
7+
- Submitting a fix
8+
- Proposing new features
9+
- Becoming a maintainer
10+
11+
## We Develop with Github
12+
We use GitHub to host code, to track issues and feature requests, as well as accept pull requests.
13+
14+
## Pull Requests
15+
Pull requests are the best way to propose changes to the codebase. We actively welcome your pull requests:
16+
17+
1. Fork the repo and create your branch from `main`.
18+
2. If you've added code that should be tested, add tests.
19+
3. If you've changed APIs, update the documentation.
20+
4. Ensure the test suite passes.
21+
5. Make sure your code lints.
22+
6. Issue that pull request!
23+
24+
25+
## Generating Documentation
26+
27+
This module uses [terraform-docs](https://terraform-docs.io/user-guide/introduction/) to generate documentation. To generate the documentation, run the following command from the root of the repository:
28+
29+
```bash
30+
.github/scripts/generate-docs.sh
31+
```
32+
33+
## Development Process
34+
35+
1. Clone the repository
36+
```bash
37+
git clone https://github.com/MaterializeInc/materialize-terraform-self-managed.git
38+
```
39+
40+
2. Create a new branch
41+
```bash
42+
git checkout -b feature/your-feature-name
43+
```
44+
45+
3. Make your changes and test them:
46+
```bash
47+
# Access the cloud provider directory, eg aws, azure, etc.
48+
cd aws # or azure, gcp, etc.
49+
50+
# Format your code
51+
terraform fmt -recursive
52+
53+
# Run linter
54+
tflint
55+
56+
# Test the examples
57+
cd examples/simple
58+
terraform init
59+
terraform plan
60+
```
61+
62+
4. Commit your changes
63+
```bash
64+
git commit -m "Add your meaningful commit message"
65+
```
66+
67+
5. Push to your fork and submit a pull request
68+
69+
## Versioning
70+
71+
We follow [Semantic Versioning](https://semver.org/). For version numbers:
72+
73+
- MAJOR version for incompatible API changes
74+
- MINOR version for added functionality in a backwards compatible manner
75+
- PATCH version for backwards compatible bug fixes
76+
77+
## Cutting a new release
78+
79+
Perform a manual test of the latest code on `main`. See prior section. Then run:
80+
81+
git tag -a vX.Y.Z -m vX.Y.Z
82+
git push origin vX.Y.Z
83+
84+
## References
85+
86+
- [Terraform Documentation](https://www.terraform.io/docs)
87+
- [Materialize Documentation](https://materialize.com/docs)

0 commit comments

Comments
 (0)