Skip to content

Commit

Permalink
Update examples after v0.11.2 release
Browse files Browse the repository at this point in the history
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
  • Loading branch information
khos2ow committed Mar 18, 2021
1 parent b58dd69 commit e127146
Show file tree
Hide file tree
Showing 11 changed files with 236 additions and 170 deletions.
22 changes: 22 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# http://editorconfig.org

# this file is the top-most editorconfig file
root = true

# all files
[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true

[*.{yaml,yml}]
indent_size = 2

[*.tf]
trim_trailing_whitespace = false

[Makefile]
indent_style = tab
21 changes: 10 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
name: Build

on:
push:
branches-ignore:
- main
pull_request:
- pull_request

jobs:
build:
Expand All @@ -14,6 +11,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}

- name: Should generate USAGE.md for tf11_basic
uses: ./
Expand Down Expand Up @@ -62,6 +61,13 @@ jobs:
with:
find-dir: examples/tf12_find

- name: Should generate README.md for tf12_config
uses: ./
with:
working-dir: examples/tf12_config
output-file: README.md
config-file: .terraform-docs.yml

- name: Should generate README.md for tf12_inject and push up all changes
uses: ./
with:
Expand All @@ -73,13 +79,6 @@ jobs:
git-push-sign-off: true
git-commit-message: "terraform-docs: automated action"

- name: Should generate README.md for tf12_config
uses: ./
with:
working-dir: examples/tf12_config
output-file: README.md
config-file: .terraform-docs.yml

- name: Should generate README.md for tf12_fail_diff and fail on diff
uses: ./
with:
Expand Down
22 changes: 11 additions & 11 deletions examples/tf11_basic/USAGE.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Test tf11 basic

## Verify

Should use the template defined instead of the default
Should inject the table under usage

## Usage

<!--- BEGIN_TF_DOCS --->
# Test tf11 basic

## Verify

Should use the template defined instead of the default
Should inject the table under usage

## Usage

<!--- BEGIN_TF_DOCS --->
### Requirements

| Name | Version |
Expand Down Expand Up @@ -50,4 +50,4 @@ No Modules.
|------|-------------|
| vpc\_id | The Id of the VPC |

<!--- END_TF_DOCS --->
<!--- END_TF_DOCS --->
66 changes: 41 additions & 25 deletions examples/tf11_extra_args/README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,41 @@
# Test tf11 extra args

## Input

```yaml
- name: Should generate USAGE.md for tf11_extra_args
uses: ./
with:
working-dir: examples/tf11_extra_args
output-format: markdown document
output-method: replace
args: --sensitive=false --hide requirements --required=false
indention: 3
```
## Verify
- Creates a document instead of table
- Indents the "##" by 3 instead of 2 ie: "###"
- Should not show required fields
- Should replace USAGE.md
## Usage
See USAGE.md
## Requirements

| Name | Version |
|------|---------|
| aws | < 2.2.0 |
| consul | >= 1.0.0 |

## Providers

| Name | Version |
|------|---------|
| aws | < 2.2.0 |
| consul | >= 1.0.0 |

## Modules

No Modules.

## Resources

| Name |
|------|
| [aws_acm_certificate](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/acm_certificate) |
| [consul_key](https://registry.terraform.io/providers/hashicorp/consul/latest/docs/data-sources/key) |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| extra\_environment | List of additional environment variables | `list` | `[]` | no |
| extra\_tags | Additional tags | `map` | `{}` | no |
| instance\_count | Number of instances to create | `string` | `"1"` | no |
| instance\_name | Instance name prefix | `string` | `"test-"` | no |
| subnet\_ids | A list of subnet ids to use | `list` | n/a | yes |
| vpc\_id | The id of the vpc | `string` | n/a | yes |

## Outputs

| Name | Description |
|------|-------------|
| vpc\_id | The Id of the VPC |
111 changes: 64 additions & 47 deletions examples/tf12_atlantis/README.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,64 @@
# Test tf12 Atlantis

## Input

```yaml
- name: Should generate README.md for tf12_atlantis
uses: ./
with:
atlantis-file: atlantis.yaml
output-file: README.md
args: --hide providers
indention: 3
```
## Verify
- Should inject below Usage in README.md
- Should not show providers section
## Usage
<!--- BEGIN_TF_DOCS --->
### Requirements
| Name | Version |
|------|---------|
| aws | ~> 2.20.0 |
| consul | >= 2.4.0 |
### Inputs
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| extra\_environment | List of additional environment variables | <pre>list(object({<br> name = string<br> value = string<br> }))</pre> | `[]` | no |
| extra\_tags | Additional tags | `map(string)` | `{}` | no |
| instance\_count | Number of instances to create | `number` | `1` | no |
| instance\_name | Instance name prefix | `string` | `"test-"` | no |
| subnet\_ids | A list of subnet ids to use | `list(string)` | n/a | yes |
| vpc\_id | The id of the vpc | `string` | n/a | yes |

### Outputs

| Name | Description |
|------|-------------|
| vpc\_id | The Id of the VPC |

<!--- END_TF_DOCS --->
# Test tf12 Atlantis

## Input

```yaml
- name: Should generate README.md for tf12_atlantis
uses: ./
with:
atlantis-file: atlantis.yaml
output-file: README.md
args: --hide providers
indention: 3
```
## Verify
- Should inject below Usage in README.md
- Should not show providers section
## Usage
<!--- BEGIN_TF_DOCS --->
### Requirements
| Name | Version |
|------|---------|
| aws | ~> 2.20.0 |
| consul | >= 2.4.0 |
### Providers
| Name | Version |
|------|---------|
| aws | ~> 2.20.0 |
| consul | >= 2.4.0 |
### Modules
No Modules.
### Resources
| Name |
|------|
| [aws_acm_certificate](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/acm_certificate) |
| [consul_key](https://registry.terraform.io/providers/hashicorp/consul/latest/docs/data-sources/key) |
### Inputs
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| extra\_environment | List of additional environment variables | <pre>list(object({<br> name = string<br> value = string<br> }))</pre> | `[]` | no |
| extra\_tags | Additional tags | `map(string)` | `{}` | no |
| instance\_count | Number of instances to create | `number` | `1` | no |
| instance\_name | Instance name prefix | `string` | `"test-"` | no |
| subnet\_ids | A list of subnet ids to use | `list(string)` | n/a | yes |
| vpc\_id | The id of the vpc | `string` | n/a | yes |

### Outputs

| Name | Description |
|------|-------------|
| vpc\_id | The Id of the VPC |
<!--- END_TF_DOCS --->
42 changes: 21 additions & 21 deletions examples/tf12_basic/README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# Test tf12 basic

## Input

```yaml
- name: Should generate README.md for tf12_bsic
uses: ./
with:
working-dir: examples/tf12_basic
output-file: README.md
indention: 3
```
## Verify
- Should inject below Usage in README.md
## Usage
<!--- BEGIN_TF_DOCS --->
# Test tf12 basic

## Input

```yaml
- name: Should generate README.md for tf12_bsic
uses: ./
with:
working-dir: examples/tf12_basic
output-file: README.md
indention: 3
```
## Verify
- Should inject below Usage in README.md
## Usage
<!--- BEGIN_TF_DOCS --->
### Requirements
| Name | Version |
Expand Down Expand Up @@ -60,4 +60,4 @@ No Modules.
|------|-------------|
| vpc\_id | The Id of the VPC |

<!--- END_TF_DOCS --->
<!--- END_TF_DOCS --->
44 changes: 22 additions & 22 deletions examples/tf12_config/README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# Test tf12 with config file

## Input

```yaml
- name: Should generate README.md for tf12_config
uses: ./
with:
working-dir: examples/tf12_config
output-file: README.md
config-file: .terraform-docs.yml
```
## Verify
- Should generate based on `examples/tf12_config/.terraform-docs.yml` spec
- Should inject below Usage in README.md

## Usage

<!--- BEGIN_TF_DOCS --->
# Test tf12 with config file

## Input

```yaml
- name: Should generate README.md for tf12_config
uses: ./
with:
working-dir: examples/tf12_config
output-file: README.md
config-file: .terraform-docs.yml
```
## Verify
- Should generate based on `examples/tf12_config/.terraform-docs.yml` spec
- Should inject below Usage in README.md

## Usage

<!--- BEGIN_TF_DOCS --->
### Inputs

| Name | Description | Type | Default | Required |
Expand All @@ -30,4 +30,4 @@
| instance\_count | Number of instances to create | `number` | `1` | no |
| instance\_name | Instance name prefix | `string` | `"test-"` | no |

<!--- END_TF_DOCS --->
<!--- END_TF_DOCS --->
Loading

0 comments on commit e127146

Please sign in to comment.