Skip to content

Commit 920de05

Browse files
authored
Merge pull request #16 from infraspecdev/test/workflow
ci: Update workflows
2 parents 59b6143 + 49dae84 commit 920de05

File tree

13 files changed

+153
-68
lines changed

13 files changed

+153
-68
lines changed
Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Pre-Commit
1+
name: Terraform Docs & Checks
22

33
on:
44
push:
@@ -11,32 +11,35 @@ on:
1111
- master
1212

1313
env:
14-
TERRAFORM_DOCS_VERSION: v0.16.0
14+
TERRAFORM_DOCS_VERSION: v0.18.0
1515
TFLINT_VERSION: v0.50.3
1616

1717
jobs:
18-
docs:
18+
generateDocs:
1919
runs-on: ubuntu-latest
2020
steps:
2121
- name: Checkout repository
2222
uses: actions/checkout@v4
2323
with:
2424
ref: ${{ github.event.pull_request.head.ref }}
2525

26-
- name: Render terraform docs and push changes back to PR
26+
- name: Render and Push terraform docs for main and modules
2727
uses: terraform-docs/gh-actions@main
2828
with:
2929
working-dir: .
30-
recursive: true
31-
recursive-path: modules
32-
output-file: README.md
33-
output-method: replace
3430
git-push: true
35-
template: <!-- BEGIN_TF_DOCS -->\n{{ .Content }}\n<!-- END_TF_DOCS -->\n{{- printf "\n" -}}
31+
config-file: .terraform-docs.yaml
3632

33+
- name: Render and Push terraform docs for examples
34+
uses: terraform-docs/gh-actions@main
35+
with:
36+
working-dir: .
37+
git-push: true
38+
config-file: .terraform-docs-example.yaml
3739

3840
collectInputs:
3941
name: Collect workflow inputs
42+
needs: generateDocs
4043
runs-on: ubuntu-latest
4144
outputs:
4245
directories: ${{ steps.dirs.outputs.directories }}

.github/workflows/documentation.yaml

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

.github/workflows/release.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ on:
44
push:
55
branches:
66
- main
7-
pull_request:
8-
branches:
9-
- main
107

118
defaults:
129
run:

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ repos:
2626
- id: check-merge-conflict
2727
- id: end-of-file-fixer
2828
- id: trailing-whitespace
29+
exclude: README.md

.terraform-docs-example.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
formatter: "markdown table"
2+
3+
header-from: ../../example.header.md
4+
footer-from: ""
5+
6+
recursive:
7+
enabled: true
8+
path: examples
9+
include-main: false
10+
11+
output:
12+
file: "README.md"
13+
mode: replace
14+
template: |-
15+
<!-- BEGIN_TF_DOCS -->
16+
{{ .Content }}
17+
<!-- END_TF_DOCS -->
18+
{{- printf "\n" -}}
19+
20+
sort:
21+
enabled: true
22+
by: name
23+
24+
settings:
25+
anchor: true
26+
color: true
27+
default: true
28+
description: false
29+
escape: true
30+
hide-empty: false
31+
html: true
32+
indent: 2
33+
lockfile: true
34+
read-comments: true
35+
required: true
36+
sensitive: true
37+
type: true

example.header.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## Usage
2+
3+
To run this example you need to execute:
4+
5+
```bash
6+
$ terraform init
7+
$ terraform plan
8+
$ terraform apply
9+
```
10+
11+
Note that this example may create resources which may cost money. Run `terraform destroy` when you don't need these resources.

examples/assign-users-and-groups-to-account/README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
<!-- BEGIN_TF_DOCS -->
2+
## Usage
3+
4+
To run this example you need to execute:
5+
6+
```bash
7+
$ terraform init
8+
$ terraform plan
9+
$ terraform apply
10+
```
11+
12+
Note that this example may create resources which may cost money. Run `terraform destroy` when you don't need these resources.
13+
214
## Requirements
315

416
| Name | Version |
@@ -8,9 +20,7 @@
820

921
## Providers
1022

11-
| Name | Version |
12-
|------|---------|
13-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.56.1 |
23+
No providers.
1424

1525
## Modules
1626

examples/create-member-account/README.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,18 @@ Note that this example may create resources which may cost money. Run `terraform
1717

1818

1919
<!-- BEGIN_TF_DOCS -->
20+
## Usage
21+
22+
To run this example you need to execute:
23+
24+
```bash
25+
$ terraform init
26+
$ terraform plan
27+
$ terraform apply
28+
```
29+
30+
Note that this example may create resources which may cost money. Run `terraform destroy` when you don't need these resources.
31+
2032
## Requirements
2133

2234
| Name | Version |
@@ -25,9 +37,8 @@ Note that this example may create resources which may cost money. Run `terraform
2537
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.51.0 |
2638

2739
## Providers
28-
| Name | Version |
29-
|------|---------|
30-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.56.1 |
40+
41+
No providers.
3142

3243
## Modules
3344

examples/create-organization/README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,18 @@ Note that this example may create resources which may cost money. Run `terraform
1616

1717

1818
<!-- BEGIN_TF_DOCS -->
19+
## Usage
20+
21+
To run this example you need to execute:
22+
23+
```bash
24+
$ terraform init
25+
$ terraform plan
26+
$ terraform apply
27+
```
28+
29+
Note that this example may create resources which may cost money. Run `terraform destroy` when you don't need these resources.
30+
1931
## Requirements
2032

2133
| Name | Version |
@@ -25,9 +37,7 @@ Note that this example may create resources which may cost money. Run `terraform
2537

2638
## Providers
2739

28-
| Name | Version |
29-
|------|---------|
30-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.56.1 |
40+
No providers.
3141

3242
## Modules
3343

examples/create-organizational-unit/README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,18 @@ Note that this example may create resources which may cost money. Run `terraform
1616

1717

1818
<!-- BEGIN_TF_DOCS -->
19+
## Usage
20+
21+
To run this example you need to execute:
22+
23+
```bash
24+
$ terraform init
25+
$ terraform plan
26+
$ terraform apply
27+
```
28+
29+
Note that this example may create resources which may cost money. Run `terraform destroy` when you don't need these resources.
30+
1931
## Requirements
2032

2133
| Name | Version |
@@ -25,9 +37,7 @@ Note that this example may create resources which may cost money. Run `terraform
2537

2638
## Providers
2739

28-
| Name | Version |
29-
|------|---------|
30-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.56.1 |
40+
No providers.
3141

3242
## Modules
3343

0 commit comments

Comments
 (0)