Skip to content

Commit 22c11bf

Browse files
authored
Initial commit
0 parents  commit 22c11bf

File tree

11 files changed

+157
-0
lines changed

11 files changed

+157
-0
lines changed

.github/workflows/main.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Auto-tag
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
jobs:
10+
tag-new-versions:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
with:
15+
fetch-depth: 2
16+
- uses: salsify/action-detect-and-tag-new-version@v2
17+
with:
18+
tag-template: "{VERSION}"
19+
version-command: |
20+
[ -f .version ] && cat .version || echo "v0.0.0"

.gitignore

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# vim temporaries
2+
*.sw[p|o|n]
3+
4+
# python bytecode
5+
*.py[c|o]
6+
7+
# system files
8+
.zfs
9+
.DS_Store
10+
.*.swp
11+
*~
12+
13+
# Ansible
14+
*.retry
15+
16+
# Terraform
17+
.terraform
18+
*.tfplan
19+
20+
# Directories used by IDEs
21+
nbproject
22+
.idea
23+
.project
24+
.settings
25+
26+
# SSH Private keys
27+
*.priv
28+
29+
# Terragrunt
30+
.terragrunt-cache
31+
.terraform.lock.hcl

.pre-commit-config.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
repos:
2+
- repo: git://github.com/antonbabenko/pre-commit-terraform
3+
rev: v1.48.0
4+
hooks:
5+
- id: terraform_fmt
6+
- id: terraform_docs
7+
files: ^.*(.md|.tf|.version)$
8+
args:
9+
- --args=--config=.terraform-docs.yml
10+
- repo: https://github.com/pre-commit/pre-commit-hooks
11+
rev: v2.3.0
12+
hooks:
13+
- id: end-of-file-fixer

.terraform-docs.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
formatter: markdown table
2+
3+
content: |-
4+
{{ .Requirements }}
5+
{{ .Modules }}
6+
{{ .Providers }}
7+
{{ .Resources }}
8+
{{ .Inputs }}
9+
{{ .Outputs }}
10+
11+
{{/* EXAMPLES */}}{{
12+
with $version := include ".version"
13+
}}{{
14+
$template := include "./examples/examples.md"
15+
}}{{
16+
range $match := regexFindAll "{{ include \".*\" }}" $template -1
17+
}}{{
18+
$fileName := index (regexSplit "\"" $match -1) 1
19+
}}{{
20+
$template = replace $match (include (print "./examples/" $fileName)) $template
21+
}}{{
22+
$template = replace "{{ provider_version }}" $version $template
23+
}}{{
24+
end
25+
}}{{
26+
$template
27+
}}{{
28+
end
29+
}}
30+
31+
32+
output:
33+
file: "README.md"
34+
mode: inject
35+
template: |-
36+
<!-- START_OF_AUTO_GENERATED_SECTION -->
37+
{{ .Content }}
38+
<!-- END_OF_AUTO_GENERATED_SECTION -->
39+
40+
sort:
41+
enabled: false
42+
43+
settings:
44+
anchor: true
45+
color: true
46+
default: true
47+
description: true
48+
escape: true
49+
hide-empty: true
50+
html: true
51+
indent: 2
52+
lockfile: true
53+
read-comments: true
54+
required: true
55+
sensitive: true
56+
type: true

.version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v0.0.1

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# template of terraform resource repository
2+
3+
<!-- START_OF_AUTO_GENERATED_SECTION -->
4+
<!-- END_OF_AUTO_GENERATED_SECTION -->
5+
6+
## Enabling pre-commit hooks
7+
8+
Following pre-commit hooks are provided:
9+
10+
- [terraform-fmt](https://github.com/antonbabenko/pre-commit-terraform#terraform_fmt) to check syntax of terraform
11+
- [terraform-docs](https://github.com/terraform-docs/terraform-docs) to recreate README.md according to terraform module properties
12+
- [end-of-file-fixer](https://github.com/pre-commit/pre-commit-hooks#end-of-file-fixer) to ensure that each file ends with newline
13+
14+
### Requirements
15+
16+
- [pre-commit](https://pre-commit.com/#installation)
17+
18+
### Installation
19+
To install `pre-commit` check .
20+
21+
```bash
22+
pre-commit install
23+
```

examples/basic/main.tf

Whitespace-only changes.

examples/examples.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## Examples
2+
3+
### Basic example
4+
```hcl
5+
{{ include "./basic/main.tf" }}
6+
```

main.tf

Whitespace-only changes.

variables.tf

Whitespace-only changes.

0 commit comments

Comments
 (0)