Skip to content

Commit 6c9ba9b

Browse files
authored
Merge pull request #3 from geekcell/update-templates
docs: update templates
2 parents 5cbd313 + 89540a4 commit 6c9ba9b

20 files changed

+246
-100
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ end_of_line = lf
88
indent_size = 2
99
indent_style = space
1010
insert_final_newline = true
11-
max_line_length = 80
11+
max_line_length = 120
1212
trim_trailing_whitespace = true
1313

1414
[*.md]

.github/.templatesyncignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
README.md
2+
.github/workflows/*
3+
.terraform-docs.yml
4+
docs/20-badges.md
5+
docs/assets/logo.svg
6+
*.tf
7+
test/*
8+
go.mod
9+
go.sum

.github/dependabot.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
##############################
3+
## Dependabot configuration ##
4+
##############################
5+
6+
#
7+
# Documentation:
8+
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuring-dependabot-version-updates
9+
#
10+
11+
version: 2
12+
updates:
13+
# Maintain dependencies for GitHub Actions
14+
- package-ecosystem: "github-actions"
15+
directory: "/"
16+
schedule:
17+
interval: "daily"
18+
open-pull-requests-limit: 0
19+
20+
# Maintain dependencies for Terraform Providers
21+
- package-ecosystem: "terraform"
22+
directory: "/"
23+
schedule:
24+
interval: "daily"
25+
open-pull-requests-limit: 0
26+
27+
# Maintain dependencies for Golang
28+
- package-ecosystem: "gomod"
29+
directory: "/"
30+
schedule:
31+
interval: "daily"
32+
open-pull-requests-limit: 0

.github/labels.yaml

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

.github/pull_request-template.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55

66
...
77

8-
## How this PR fixes it
9-
10-
...
11-
128
## Readiness Checklist
139

1410
### Author/Contributor

.github/workflows/release.yaml

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
2-
####################################
3-
## Draft releases on Push to main ##
4-
####################################
2+
#####################
3+
## Create releases ##
4+
#####################
55

66
#
77
# Documentation:
@@ -13,9 +13,8 @@ on:
1313
push:
1414
branches: [ main ]
1515
tags: [ 'v*.*.*' ]
16-
17-
permissions:
18-
contents: write
16+
pull_request:
17+
types: [ labeled ]
1918

2019
#################
2120
# Start the job #
@@ -26,6 +25,7 @@ jobs:
2625
###############
2726
create-release:
2827
name: Create Release
28+
if: github.event.action != 'labeled'
2929
runs-on: ubuntu-latest
3030
timeout-minutes: 10
3131
steps:
@@ -75,3 +75,22 @@ jobs:
7575
tag_name: ${{ steps.tag.outputs.value }}
7676
draft: false
7777
prerelease: false
78+
79+
###########################
80+
# Release preview comment #
81+
###########################
82+
release-check:
83+
if: github.event.action == 'labeled'
84+
runs-on: ubuntu-latest
85+
steps:
86+
############################
87+
# Checkout the source code #
88+
############################
89+
- name: Checkout Code
90+
uses: actions/checkout@v3.1.0
91+
92+
#######################
93+
# Post status comment #
94+
#######################
95+
- name: Post bumpr status comment
96+
uses: haya14busa/action-bumpr@v1

.github/workflows/sync-templates.yaml

Lines changed: 11 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010

1111
name: Sync templates
1212
on:
13-
workflow_dispatch:
13+
workflow_dispatch: # Trigger manually
14+
schedule:
15+
- cron: "0 0 1 * *" # Run at 00:00 on the first day of every month
1416

1517
##########################
1618
# Prevent duplicate jobs #
@@ -36,7 +38,7 @@ jobs:
3638
- name: Sync labels
3739
uses: EndBug/label-sync@v2.3.1
3840
with:
39-
config-file: https://raw.githubusercontent.com/geekcell/template-terraform-module/main/.github/labels.yaml
41+
config-file: https://gist.githubusercontent.com/Ic3w0lf/f5520c5f19d7098966f692c120f7a197/raw/75b134f76fbc55e2e64bd66f04e571d6d74b815e/terraform-aws-module-labels.yaml
4042

4143
#######################
4244
# Sync template files #
@@ -50,33 +52,12 @@ jobs:
5052
############################
5153
- name: Checkout Code
5254
uses: actions/checkout@v3.1.0
53-
with:
54-
token: ${{ secrets.GEEKCELL_PAT_WORKFLOWS }}
55-
56-
########################
57-
# Patch template files #
58-
########################
59-
- name: Force patching of template files
60-
run: |
61-
yes y | make setup/update-template
62-
63-
####################
64-
# Update README.md #
65-
####################
66-
- name: Terraform docs
67-
uses: terraform-docs/gh-actions@v1.0.0
68-
with:
69-
config-file: .terraform-docs.yml
70-
git-push: false
7155

72-
#############
73-
# Create PR #
74-
#############
75-
- name: Create PR
76-
uses: peter-evans/create-pull-request@v4.2.0
56+
#######################
57+
# Sync template files #
58+
#######################
59+
- name: actions-template-sync
60+
uses: AndreasAugustin/actions-template-sync@v0.7.3
7761
with:
78-
token: ${{ secrets.GEEKCELL_PAT_WORKFLOWS }}
79-
title: Updated template files
80-
commit-message: Update template files from main repo
81-
branch: update-template-files
82-
delete-branch: true
62+
github_token: ${{ secrets.GITHUB_TOKEN }}
63+
source_repo_path: geekcell/terraform-aws-module-template

.pre-commit-config.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
repos:
22
- repo: https://github.com/antonbabenko/pre-commit-terraform
3-
rev: v1.76.0
3+
rev: v1.80.0
44
hooks:
55
- id: terraform_docs
66
- id: terraform_fmt
77
- id: terraform_validate
8+
args:
9+
- --hook-config=--retry-once-with-cleanup=true
810
exclude: '^[^/]+$'
911
- id: terraform_tflint
1012
exclude: ^examples/
1113

1214
- repo: https://github.com/pre-commit/pre-commit-hooks
13-
rev: v4.3.0
15+
rev: v4.4.0
1416
hooks:
1517
- id: trailing-whitespace
1618
- id: end-of-file-fixer

.terraform-docs.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
formatter: "md table"
22
header-from: main.tf
33

4+
recursive:
5+
# Enable this if your module has submodules
6+
enabled: true
7+
48
content: |-
5-
{{ include "docs/logo.md" }}
9+
{{ include "docs/10-header.md" }}
610
7-
{{ include "docs/badges.md" }}
11+
{{ include "docs/20-badges.md" }}
812
913
{{ .Header }}
1014

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!-- BEGIN_TF_DOCS -->
2-
[![Geek Cell GmbH](https://raw.githubusercontent.com/geekcell/template-terraform-module/main/docs/assets/logo.svg)](https://www.geekcell.io/)
2+
[![Geek Cell GmbH](https://raw.githubusercontent.com/geekcell/.github/main/geekcell-github-banner.png)](https://www.geekcell.io/)
33

44
### Code Quality
55
[![License](https://img.shields.io/github/license/geekcell/terraform-aws-memorydb-cluster)](https://github.com/geekcell/terraform-aws-memorydb-cluster/blob/master/LICENSE)
@@ -8,6 +8,9 @@
88
[![Validate](https://github.com/geekcell/terraform-aws-memorydb-cluster/actions/workflows/validate.yaml/badge.svg)](https://github.com/geekcell/terraform-aws-memorydb-cluster/actions/workflows/validate.yaml)
99
[![Lint](https://github.com/geekcell/terraform-aws-memorydb-cluster/actions/workflows/linter.yaml/badge.svg)](https://github.com/geekcell/terraform-aws-memorydb-cluster/actions/workflows/linter.yaml)
1010

11+
<!--
12+
Comment in if Bridgecrew is configured
13+
1114
### Security
1215
[![Infrastructure Tests](https://www.bridgecrew.cloud/badges/github/geekcell/terraform-aws-memorydb-cluster/general)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=geekcell%2Fterraform-aws-memorydb-cluster&benchmark=INFRASTRUCTURE+SECURITY)
1316
@@ -33,13 +36,12 @@
3336
[![Infrastructure Tests](https://www.bridgecrew.cloud/badges/github/geekcell/terraform-aws-memorydb-cluster/hipaa)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=geekcell%2Fterraform-aws-memorydb-cluster&benchmark=HIPAA)
3437
[![Infrastructure Tests](https://www.bridgecrew.cloud/badges/github/geekcell/terraform-aws-memorydb-cluster/fedramp_moderate)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=geekcell%2Fterraform-aws-memorydb-cluster&benchmark=FEDRAMP+%28MODERATE%29)
3538
36-
# Terraform AWS MemoryDB Cluster
39+
-->
3740

38-
Terraform module which creates a MemoryDB Cluster. The focus on this
39-
module lies within it's simplicity by providing default values that
40-
should make sense for most use cases.
41+
# Terraform AWS MemoryDB Cluster
4142

42-
It also makes use of the latest Terraform
43+
Terraform module which creates a MemoryDB Cluster. The focus on this module lies within it's simplicity by providing
44+
default values that should make sense for most use cases.
4345

4446
## Inputs
4547

@@ -81,7 +83,7 @@ It also makes use of the latest Terraform
8183

8284
## Resources
8385

84-
- resource.aws_memorydb_cluster.main (main.tf#10)
86+
- resource.aws_memorydb_cluster.main (main.tf#7)
8587

8688
# Examples
8789
### Full

docs/10-header.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[![Geek Cell GmbH](https://raw.githubusercontent.com/geekcell/.github/main/geekcell-github-banner.png)](https://www.geekcell.io/)

docs/badges.md renamed to docs/20-badges.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
[![Validate](https://github.com/geekcell/terraform-aws-memorydb-cluster/actions/workflows/validate.yaml/badge.svg)](https://github.com/geekcell/terraform-aws-memorydb-cluster/actions/workflows/validate.yaml)
66
[![Lint](https://github.com/geekcell/terraform-aws-memorydb-cluster/actions/workflows/linter.yaml/badge.svg)](https://github.com/geekcell/terraform-aws-memorydb-cluster/actions/workflows/linter.yaml)
77

8+
<!--
9+
Comment in if Bridgecrew is configured
10+
811
### Security
912
[![Infrastructure Tests](https://www.bridgecrew.cloud/badges/github/geekcell/terraform-aws-memorydb-cluster/general)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=geekcell%2Fterraform-aws-memorydb-cluster&benchmark=INFRASTRUCTURE+SECURITY)
1013
@@ -29,3 +32,5 @@
2932
[![Infrastructure Tests](https://www.bridgecrew.cloud/badges/github/geekcell/terraform-aws-memorydb-cluster/nist)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=geekcell%2Fterraform-aws-memorydb-cluster&benchmark=NIST-800-53)
3033
[![Infrastructure Tests](https://www.bridgecrew.cloud/badges/github/geekcell/terraform-aws-memorydb-cluster/hipaa)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=geekcell%2Fterraform-aws-memorydb-cluster&benchmark=HIPAA)
3134
[![Infrastructure Tests](https://www.bridgecrew.cloud/badges/github/geekcell/terraform-aws-memorydb-cluster/fedramp_moderate)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=geekcell%2Fterraform-aws-memorydb-cluster&benchmark=FEDRAMP+%28MODERATE%29)
35+
36+
-->

docs/logo.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

main.tf

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
/**
22
* # Terraform AWS MemoryDB Cluster
33
*
4-
* Terraform module which creates a MemoryDB Cluster. The focus on this
5-
* module lies within it's simplicity by providing default values that
6-
* should make sense for most use cases.
7-
*
8-
* It also makes use of the latest Terraform
4+
* Terraform module which creates a MemoryDB Cluster. The focus on this module lies within it's simplicity by providing
5+
* default values that should make sense for most use cases.
96
*/
107
resource "aws_memorydb_cluster" "main" {
118
name = var.name
@@ -44,34 +41,44 @@ resource "aws_memorydb_cluster" "main" {
4441
}
4542

4643
module "memorydb_parameter_group" {
47-
source = "./modules/memorydb_parameter_group"
44+
source = "./modules/memorydb_parameter_group"
45+
4846
name = var.name
4947
parameters = var.parameters
5048
}
5149

5250
module "memorydb_user" {
5351
source = "./modules/memorydb_user"
54-
name = var.name
55-
users = var.users
52+
53+
name = var.name
54+
users = var.users
5655
}
5756

5857
module "memorydb_subnet_group" {
59-
source = "./modules/memorydb_subnet_group"
58+
source = "./modules/memorydb_subnet_group"
59+
6060
name = var.name
6161
subnet_ids = var.subnet_ids
6262
}
6363

6464
module "kms" {
6565
for_each = toset(["storage"])
66-
source = "github.com/geekcell/terraform-aws-kms?ref=v1.0"
67-
alias = format("alias/rdb/cluster/%s/${each.value}", var.name)
66+
67+
source = "geekcell/kms/aws"
68+
version = ">= 1.0.0, < 2.0.0"
69+
70+
alias = "alias/rdb/cluster/${var.name}/${each.value}"
71+
tags = var.tags
6872
}
6973

7074
module "sns" {
7175
for_each = toset(["notification"])
7276

73-
source = "github.com/geekcell/terraform-aws-sns-email-notification?ref=v1.0"
74-
name = "${var.name}-memorydb-${each.value}"
77+
source = "geekcell/sns-email-notification/aws"
78+
version = ">= 1.0.0, < 2.0.0"
7579

80+
name = "${var.name}-memorydb-${each.value}"
7681
email_addresses = var.recipients
82+
83+
tags = var.tags
7784
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
content: |-
2+
{{ .Header }}
3+
4+
{{ .Inputs }}
5+
6+
{{ .Outputs }}
7+
8+
{{ .Providers }}
9+
10+
## Resources
11+
{{ range .Module.Resources }}
12+
- {{ .GetMode }}.{{ .Spec }} ({{ .Position.Filename }}#{{ .Position.Line }})
13+
{{- end }}

0 commit comments

Comments
 (0)