Skip to content

Commit

Permalink
Merge pull request #3 from geekcell/update-templates
Browse files Browse the repository at this point in the history
docs: update templates
  • Loading branch information
Ic3w0lf authored Jun 28, 2023
2 parents e375a76 + ebe7e92 commit 0e07a32
Show file tree
Hide file tree
Showing 14 changed files with 103 additions and 111 deletions.
9 changes: 9 additions & 0 deletions .github/.templatesyncignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
README.md
.github/workflows/*
.terraform-docs.yml
docs/20-badges.md
docs/assets/logo.svg
*.tf
test/*
go.mod
go.sum
32 changes: 32 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
##############################
## Dependabot configuration ##
##############################

#
# Documentation:
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuring-dependabot-version-updates
#

version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
open-pull-requests-limit: 0

# Maintain dependencies for Terraform Providers
- package-ecosystem: "terraform"
directory: "/"
schedule:
interval: "daily"
open-pull-requests-limit: 0

# Maintain dependencies for Golang
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"
open-pull-requests-limit: 0
34 changes: 0 additions & 34 deletions .github/labels.yaml

This file was deleted.

4 changes: 0 additions & 4 deletions .github/pull_request-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@

...

## How this PR fixes it

...

## Readiness Checklist

### Author/Contributor
Expand Down
31 changes: 25 additions & 6 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
####################################
## Draft releases on Push to main ##
####################################
#####################
## Create releases ##
#####################

#
# Documentation:
Expand All @@ -13,9 +13,8 @@ on:
push:
branches: [ main ]
tags: [ 'v*.*.*' ]

permissions:
contents: write
pull_request:
types: [ labeled ]

#################
# Start the job #
Expand All @@ -26,6 +25,7 @@ jobs:
###############
create-release:
name: Create Release
if: github.event.action != 'labeled'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
Expand Down Expand Up @@ -75,3 +75,22 @@ jobs:
tag_name: ${{ steps.tag.outputs.value }}
draft: false
prerelease: false

###########################
# Release preview comment #
###########################
release-check:
if: github.event.action == 'labeled'
runs-on: ubuntu-latest
steps:
############################
# Checkout the source code #
############################
- name: Checkout Code
uses: actions/[email protected]

#######################
# Post status comment #
#######################
- name: Post bumpr status comment
uses: haya14busa/action-bumpr@v1
41 changes: 11 additions & 30 deletions .github/workflows/sync-templates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@

name: Sync templates
on:
workflow_dispatch:
workflow_dispatch: # Trigger manually
schedule:
- cron: "0 0 1 * *" # Run at 00:00 on the first day of every month

##########################
# Prevent duplicate jobs #
Expand All @@ -36,7 +38,7 @@ jobs:
- name: Sync labels
uses: EndBug/[email protected]
with:
config-file: https://raw.githubusercontent.com/geekcell/template-terraform-module/main/.github/labels.yaml
config-file: https://gist.githubusercontent.com/Ic3w0lf/f5520c5f19d7098966f692c120f7a197/raw/75b134f76fbc55e2e64bd66f04e571d6d74b815e/terraform-aws-module-labels.yaml

#######################
# Sync template files #
Expand All @@ -50,33 +52,12 @@ jobs:
############################
- name: Checkout Code
uses: actions/[email protected]
with:
token: ${{ secrets.GEEKCELL_PAT_WORKFLOWS }}

########################
# Patch template files #
########################
- name: Force patching of template files
run: |
yes y | make setup/update-template
####################
# Update README.md #
####################
- name: Terraform docs
uses: terraform-docs/[email protected]
with:
config-file: .terraform-docs.yml
git-push: false

#############
# Create PR #
#############
- name: Create PR
uses: peter-evans/[email protected]
#######################
# Sync template files #
#######################
- name: actions-template-sync
uses: AndreasAugustin/[email protected]
with:
token: ${{ secrets.GEEKCELL_PAT_WORKFLOWS }}
title: Updated template files
commit-message: Update template files from main repo
branch: update-template-files
delete-branch: true
github_token: ${{ secrets.GITHUB_TOKEN }}
source_repo_path: geekcell/terraform-aws-module-template
6 changes: 4 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.76.0
rev: v1.80.0
hooks:
- id: terraform_docs
- id: terraform_fmt
- id: terraform_validate
args:
- --hook-config=--retry-once-with-cleanup=true
exclude: '^[^/]+$'
- id: terraform_tflint
exclude: ^examples/

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
9 changes: 7 additions & 2 deletions .terraform-docs.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
formatter: "md table"
header-from: main.tf

recursive:
# Enable this if your module has submodules
enabled: false

content: |-
{{ include "docs/logo.md" }}
{{ include "docs/10-header.md" }}
{{ include "docs/badges.md" }}
{{ include "docs/20-badges.md" }}
{{ .Header }}
Expand All @@ -24,6 +28,7 @@ content: |-
```hcl
{{ include "examples/basic-example/main.tf" }}
```
### with enhanced Backups
```hcl
{{ include "examples/with-enhanced-backups/main.tf" }}
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
<!-- BEGIN_TF_DOCS -->
[![Geek Cell GmbH](https://raw.githubusercontent.com/geekcell/template-terraform-module/main/docs/assets/logo.svg)](https://www.geekcell.io/)

<!--
Comment in these badges if they apply to the repository.
[![Geek Cell GmbH](https://raw.githubusercontent.com/geekcell/.github/main/geekcell-github-banner.png)](https://www.geekcell.io/)

### Code Quality
[![License](https://img.shields.io/github/license/geekcell/terraform-aws-efs)](https://github.com/geekcell/terraform-aws-efs/blob/master/LICENSE)
Expand All @@ -11,6 +8,9 @@ Comment in these badges if they apply to the repository.
[![Validate](https://github.com/geekcell/terraform-aws-efs/actions/workflows/validate.yaml/badge.svg)](https://github.com/geekcell/terraform-aws-efs/actions/workflows/validate.yaml)
[![Lint](https://github.com/geekcell/terraform-aws-efs/actions/workflows/linter.yaml/badge.svg)](https://github.com/geekcell/terraform-aws-efs/actions/workflows/linter.yaml)

<!--
Comment in these badges if they apply to the repository.
### Security
[![Infrastructure Tests](https://www.bridgecrew.cloud/badges/github/geekcell/terraform-aws-efs/general)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=geekcell%2Fterraform-aws-efs&benchmark=INFRASTRUCTURE+SECURITY)
Expand Down Expand Up @@ -88,6 +88,7 @@ module "basic-example" {
security_groups = ["sg-12345678"]
}
```

### with enhanced Backups
```hcl
module "with-enhanced-backups" {
Expand Down
1 change: 1 addition & 0 deletions docs/10-header.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[![Geek Cell GmbH](https://raw.githubusercontent.com/geekcell/.github/main/geekcell-github-banner.png)](https://www.geekcell.io/)
6 changes: 3 additions & 3 deletions docs/badges.md → docs/20-badges.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<!--
Comment in these badges if they apply to the repository.
### Code Quality
[![License](https://img.shields.io/github/license/geekcell/terraform-aws-efs)](https://github.com/geekcell/terraform-aws-efs/blob/master/LICENSE)
[![GitHub release (latest tag)](https://img.shields.io/github/v/release/geekcell/terraform-aws-efs?logo=github&sort=semver)](https://github.com/geekcell/terraform-aws-efs/releases)
[![Release](https://github.com/geekcell/terraform-aws-efs/actions/workflows/release.yaml/badge.svg)](https://github.com/geekcell/terraform-aws-efs/actions/workflows/release.yaml)
[![Validate](https://github.com/geekcell/terraform-aws-efs/actions/workflows/validate.yaml/badge.svg)](https://github.com/geekcell/terraform-aws-efs/actions/workflows/validate.yaml)
[![Lint](https://github.com/geekcell/terraform-aws-efs/actions/workflows/linter.yaml/badge.svg)](https://github.com/geekcell/terraform-aws-efs/actions/workflows/linter.yaml)

<!--
Comment in these badges if they apply to the repository.
### Security
[![Infrastructure Tests](https://www.bridgecrew.cloud/badges/github/geekcell/terraform-aws-efs/general)](https://www.bridgecrew.cloud/link/badge?vcs=github&fullRepo=geekcell%2Fterraform-aws-efs&benchmark=INFRASTRUCTURE+SECURITY)
Expand Down
22 changes: 0 additions & 22 deletions docs/assets/logo.svg

This file was deleted.

1 change: 0 additions & 1 deletion docs/logo.md

This file was deleted.

9 changes: 6 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@ resource "aws_efs_file_system_policy" "main" {
resource "random_uuid" "main" {}

module "backup" {
count = var.enable_enhanced_backups ? 1 : 0
source = "github.com/geekcell/terraform-aws-backup?ref=v1.0"
count = var.enable_enhanced_backups ? 1 : 0

source = "geekcell/backup/aws"
version = ">= 1.0.0, < 2.0.0"

vault_name = var.name
backup_name = var.name
Expand All @@ -67,7 +69,8 @@ module "backup" {
}

module "kms" {
source = "github.com/geekcell/terraform-aws-kms?ref=v1.0"
source = "geekcell/kms/aws"
version = ">= 1.0.0, < 2.0.0"

alias = format("alias/efs/%s", var.name)
}

0 comments on commit 0e07a32

Please sign in to comment.