Skip to content

Commit c44dc65

Browse files
authored
Initial commit
0 parents  commit c44dc65

31 files changed

+1030
-0
lines changed

.github/workflows/documentation.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: generate-terraform-docs
2+
# This workflow will generate terraform docs into README.md in the root, examples, and modules folders.
3+
# Source: https://github.com/equinix-labs/terraform-equinix-kubernetes-addons/blob/main/.github/workflows/documentation.yaml
4+
5+
on:
6+
push:
7+
branches:
8+
- main
9+
paths:
10+
- '**/*.tpl'
11+
- '**/*.tf'
12+
13+
jobs:
14+
tf-docs:
15+
name: TF docs
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v3
19+
id: actions-checkout
20+
with:
21+
ref: main
22+
23+
- name: Render terraform docs inside the main and the modules README.md files and push changes back to PR branch
24+
id: terraform-docs
25+
uses: terraform-docs/[email protected]
26+
with:
27+
find-dir: .
28+
args: --sort-by required
29+
indention: 2
30+
git-push: "false"
31+
32+
# terraform-docs/[email protected] modifies .git files with owner root:root, and the following steps fail with
33+
# insufficient permission for adding an object to repository database .git/objects
34+
# since the expected user is runner:docker. See https://github.com/terraform-docs/gh-actions/issues/90
35+
- name: Fix .git owner
36+
run: sudo chown runner:docker -R .git
37+
38+
- name: Create Pull Request
39+
if: steps.terraform-docs.outputs.num_changed != '0'
40+
uses: peter-evans/create-pull-request@v4
41+
with:
42+
commit-message: 'generate-terraform-docs: automated action'
43+
committer: GitHub <[email protected]>
44+
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
45+
title: 'generate-terraform-docs: automated action'
46+
body: |
47+
Update terraform docs
48+
branch-suffix: timestamp
49+
base: main
50+
signoff: true
51+
delete-branch: true
52+
53+
# TODO(ocobleseqx): https://github.com/peter-evans/enable-pull-request-automerge

.github/workflows/pre-commit.yaml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: 'run-pre-commit-hooks'
2+
# This workflow runs the pre-commit hooks defined in .pre-commit-config.yaml
3+
4+
on:
5+
pull_request:
6+
branches: [main]
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
pre-commit:
14+
runs-on: ${{ matrix.os }}
15+
env:
16+
TF_VERSION: ${{ matrix.tf }}
17+
TFLINT_VERSION: ${{ matrix.tflint }}
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
strategy:
20+
matrix:
21+
os: [ubuntu-latest]
22+
tf: [1.3.0]
23+
tflint: [v0.44.1]
24+
permissions:
25+
pull-requests: write
26+
id-token: write
27+
contents: read
28+
steps:
29+
- name: Checkout from Github
30+
uses: actions/checkout@v3
31+
32+
- name: Install Python3
33+
uses: actions/setup-python@v4
34+
35+
- name: Install tflint
36+
uses: terraform-linters/setup-tflint@v3
37+
with:
38+
tflint_version: ${{ env.TFLINT_VERSION }}
39+
40+
- name: Cache tflint plugin dir
41+
uses: actions/cache@v3
42+
with:
43+
path: ~/.tflint.d/plugins
44+
key: ${{ matrix.os }}-tflint-${{ hashFiles('.tflint.hcl') }}
45+
46+
- name: Install Terraform
47+
uses: hashicorp/setup-terraform@v2
48+
with:
49+
terraform_version: ${{ env.TF_VERSION }}
50+
51+
- name: Config Terraform plugin cache
52+
run: |
53+
echo 'plugin_cache_dir="$HOME/.terraform.d/plugin-cache"' >~/.terraformrc
54+
mkdir --parents ~/.terraform.d/plugin-cache
55+
56+
- name: Cache Terraform
57+
uses: actions/cache@v3
58+
with:
59+
path: |
60+
~/.terraform.d/plugin-cache
61+
key: ${{ runner.os }}-terraform-${{ hashFiles('**/.terraform.lock.hcl') }}
62+
restore-keys: |
63+
${{ runner.os }}-terraform-
64+
65+
- name: Install tfsec
66+
uses: jaxxstorm/[email protected]
67+
with:
68+
repo: aquasecurity/tfsec
69+
platform: linux
70+
arch: x86-64
71+
72+
- uses: pre-commit/[email protected]

.gitignore

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# OSX leaves these everywhere on SMB shares
2+
._*
3+
4+
# OSX trash
5+
**/.DS_Store
6+
*.pyc*
7+
8+
# Emacs save files
9+
*~
10+
\#*\#
11+
.\#*
12+
13+
# Vim-related files
14+
[._]*.s[a-w][a-z]
15+
[._]s[a-w][a-z]
16+
*.un~
17+
Session.vim
18+
.netrwhist
19+
20+
# Local .terraform directories
21+
**/.terraform/*
22+
**/*/.terraform/*
23+
.terraform*
24+
25+
# .tfstate files
26+
*.tfstate
27+
*.tfstate.*
28+
29+
# Crash log files
30+
crash.log
31+
32+
# Ignore any .tfvars files that are generated automatically for each Terraform run. Most
33+
# .tfvars files are managed as part of configuration and so should be included in
34+
# version control.
35+
#
36+
# example.tfvars
37+
38+
# Ignore override files as they are usually used to override resources locally and so
39+
# are not checked in
40+
override.tf
41+
override.tf.json
42+
*_override.tf
43+
*_override.tf.json
44+
45+
# Include override files you do wish to add to version control using negated pattern
46+
#
47+
# !example_override.tf
48+
!.terraform.lock.hcl
49+
**/*/.terraform.lock.hcl
50+
51+
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
52+
# example: *tfplan*
53+
**/terraform.tfvars
54+
util/keys
55+
56+
*-kubeconfig

.mdl_style.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
all
2+
3+
exclude_rule 'MD013'
4+
rule 'MD029', style: ['ordered']
5+
exclude_rule 'MD033'
6+
exclude_rule 'MD041'
7+
exclude_rule 'MD047'

.mdlrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
style '.mdl_style.rb'

.pre-commit-config.yaml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
---
2+
fail_fast: false
3+
repos:
4+
5+
- repo: https://github.com/antonbabenko/pre-commit-terraform
6+
rev: v1.77.1
7+
hooks:
8+
- id: terraform_fmt
9+
args:
10+
- "--args=-recursive"
11+
- id: terraform_validate
12+
exclude: "^[^/]+$"
13+
- id: terraform_tflint
14+
args:
15+
- "--args=--config=__GIT_WORKING_DIR__/.tflint.hcl"
16+
- id: terraform_tfsec
17+
args:
18+
- "--args=--soft-fail"
19+
20+
- repo: https://github.com/pre-commit/pre-commit-hooks
21+
rev: v4.4.0
22+
hooks:
23+
# Git style
24+
- id: check-added-large-files
25+
- id: check-merge-conflict
26+
- id: check-vcs-permalinks
27+
- id: forbid-new-submodules
28+
- id: no-commit-to-branch
29+
args: ['--branch', 'master']
30+
31+
# Common errors
32+
- id: end-of-file-fixer
33+
- id: trailing-whitespace
34+
args:
35+
- "--markdown-linebreak-ext=md"
36+
exclude: CHANGELOG.md
37+
- id: check-yaml
38+
args:
39+
- "--allow-multiple-documents"
40+
exclude: |
41+
(?x)^(
42+
examples/|
43+
\.*?.yaml$"
44+
)$
45+
- id: check-json
46+
- id: check-symlinks
47+
- id: check-executables-have-shebangs
48+
49+
# Cross platform
50+
- id: check-case-conflict
51+
- id: mixed-line-ending
52+
args:
53+
- "--fix=lf"
54+
55+
# Security
56+
- id: detect-private-key
57+
58+
# Shell Script Formatter and Markdown Linter
59+
- repo: https://github.com/jumanjihouse/pre-commit-hooks
60+
rev: 3.0.0
61+
hooks:
62+
- id: shfmt
63+
exclude: |
64+
(?x)^(
65+
helpers/helper-script.sh|
66+
scripts/template-script.sh
67+
)$
68+
- id: shellcheck
69+
args:
70+
- "--severity=warning"
71+
- "--source-path=SCRIPTDIR scripts/* helpers/*"
72+
- "--shell=bash"
73+
exclude: |
74+
(?x)^(
75+
helpers/helper-script.sh|
76+
scripts/template-script.sh
77+
)$
78+
- id: markdownlint
79+
exclude: "CHANGELOG.md"
80+
81+
# JSON5 and Yaml Prettyfier
82+
- repo: https://github.com/pre-commit/mirrors-prettier
83+
rev: v3.0.0-alpha.4
84+
hooks:
85+
- id: prettier
86+
types: [json5, yaml]
87+
exclude: "^examples/"

.terraform.lock.hcl

Whitespace-only changes.

.tflint.hcl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
plugin "terraform" {
2+
enabled = true
3+
version = "0.2.2"
4+
source = "github.com/terraform-linters/tflint-ruleset-terraform"
5+
}

CHANGELOG.md

Whitespace-only changes.

CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# TEMPLATE: add your username after terraform
2+
# TEMPLATE: * equinix-labs/terraform myusername
3+
* @equinix-labs/terraform

0 commit comments

Comments
 (0)