Commit Graph

84 Commits

Author SHA1 Message Date
dependabot[bot]
e470746449 chore(deps): bump golang.org/x/net from 0.29.0 to 0.33.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.29.0 to 0.33.0.
- [Commits](https://github.com/golang/net/compare/v0.29.0...v0.33.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-11 14:09:25 +00:00
dependabot[bot]
006ff31f25 chore(deps): bump golang.org/x/crypto from 0.27.0 to 0.31.0
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.27.0 to 0.31.0.
- [Commits](https://github.com/golang/crypto/compare/v0.27.0...v0.31.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-12 00:28:11 +00:00
Khosrow Moossavi
3355644e98 chore: update go dependencies
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2024-09-18 12:09:10 -04:00
dependabot[bot]
045e5e69db Bump google.golang.org/grpc from 1.64.0 to 1.64.1
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.64.0 to 1.64.1.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.64.0...v1.64.1)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-07-09 21:46:59 +00:00
Khosrow Moossavi
288faea0e5 chore: update dependencies
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2024-05-27 14:53:24 -04:00
dependabot[bot]
ff0ce4493f Bump google.golang.org/protobuf from 1.31.0 to 1.33.0
Bumps google.golang.org/protobuf from 1.31.0 to 1.33.0.

---
updated-dependencies:
- dependency-name: google.golang.org/protobuf
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Brittan DeYoung <32572259+brittandeyoung@users.noreply.github.com>
2024-05-17 10:01:04 -04:00
Brittan DeYoung
740e0a8091 go get -u github.com/hashicorp/hcl/v2, update to v0.20.1 to support provider functions
Signed-off-by: Brittan DeYoung <32572259+brittandeyoung@users.noreply.github.com>
2024-05-17 10:01:04 -04:00
Khosrow Moossavi
a321c282f2 Bump golang to 1.22.1
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2024-03-22 11:38:24 -04:00
Florent Monbillard
656aa7c299 Update go crypto lib to v0.17.0
Signed-off-by: Florent Monbillard <f.monbillard@gmail.com>
2023-12-21 11:28:44 -05:00
Khosrow Moossavi
4552242276 Update go module dependencies
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2023-12-19 11:57:20 -05:00
Aurelian Shuttleworth
21a97452cd Upgrade Google Cloud Go packages in go.sum
Numerous Google Cloud Go packages have been upgraded to their latest versions in the go.sum dependencies file. This enhances the codebase with the latest features, improvements, and bug fixes offered by these packages. It's part of an effort to keep the project's dependencies up to date and ensure the application runs optimally with the latest available resources.

Signed-off-by: Aurelian Shuttleworth <aurelian@shuttleworth.tech>
2023-12-04 17:30:12 +01:00
Khosrow Moossavi
649f1c46c7 Update go module dependencies
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2022-07-26 18:59:42 -04:00
Khosrow Moossavi
5727f8b412 Preserve whitespaces of provided content and template
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2022-01-07 18:14:21 -05:00
Khosrow Moossavi
5fad7abe34 Update go dependencies
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2022-01-06 19:07:08 -05:00
Khosrow Moossavi
4a9ffe7c33 Move plugin-sdk to in-tree in core repository
Moving terraform-docs/plugin-sdk standalone module to in-tree, because
maintaining both of them, specifically if anything needs to be added to
Config, or terraform will required dual effort on both repository. As
such now everything is consolidated under one repository. Example usage
for plugin developer after this move is as follow:

```go
package main

import (
	_ "embed" //nolint

	"github.com/terraform-docs/terraform-docs/plugin"
	"github.com/terraform-docs/terraform-docs/print"
	"github.com/terraform-docs/terraform-docs/template"
	"github.com/terraform-docs/terraform-docs/terraform"
)

func main() {
	plugin.Serve(&plugin.ServeOpts{
		Name:    "template",
		Version: "0.1.0",
		Printer: printer,
	})
}

//go:embed sections.tmpl
var tplCustom []byte

// Print the custom format template. You have all the flexibility to generate
// the output however you choose to.
func printer(config *print.Config, module *terraform.Module) (string, error) {
	tpl := template.New(config,
		&template.Item{Name: "custom", Text: string(tplCustom)},
	)

	rendered, err := tpl.Render("custom", module)
	if err != nil {
		return "", err
	}

	return rendered, nil
}
```

Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2021-10-05 18:54:49 -04:00
Khosrow Moossavi
89648f769f Add sprig functions to built-in template functions
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2021-10-04 20:58:54 -04:00
Nassos Kat
f61375077e Add 'HideEmpy' section bool flag
* Add 'HideEmpy' section to Settings

Signed-off-by: akatsadimas <nkatsadim@gmail.com>

* Address review comments

fixed linting and docs, moved HideEmpty to Settings struct

Signed-off-by: akatsadimas <nkatsadim@gmail.com>

* Address review comment

document hideempty configuration option

Signed-off-by: akatsadimas <nkatsadim@gmail.com>

* Address review comments - improve docs

Signed-off-by: akatsadimas <nkatsadim@gmail.com>
2021-08-31 17:17:16 -04:00
Khosrow Moossavi
209ed6679e Upgrade go dependencies
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2021-07-28 15:17:32 -04:00
Khosrow Moossavi
d004771860 Add support for generating Packer document
Packer config, since 1.7.0, prefers HCL2 which effectively makes us to
reuse the same binary for generating documentation for it with terraform-docs
as well. The missing part was that terraform-config-inspect did not
recognize `pkr.hcl` and `pkr.json` as valid formats, which this fixes that.

Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2021-07-28 12:48:37 -04:00
Khosrow Moossavi
6777364257 Customize content with individual sections output
Generated content can be customized further away with `content` in configuration.
If the `content` is empty the default orders of section is used. `content` is a
Go template with following additional variables:

- `{{ .Header }}`
- `{{ .Footer }}`
- `{{ .Inputs }}`
- `{{ .Modules }}`
- `{{ .Outputs }}`
- `{{ .Providers }}`
- `{{ .Requirements }}`
- `{{ .Resources }}`

```yaml
content: |-
  Any arbitrary text can be placed anywhere in the content

  {{ .Header }}

  and even in between sections

  {{ .Providers }}

  and they don't even need to be in the default order

  {{ .Outputs }}

  {{ .Inputs }}
```

These variables are the generated output of individual sections in the selected
formatter. For example `{{ .Inputs }}` is Markdown Table representation of inputs
when formatter is set to `markdown table` and AsciiDoc Document representation
when formatter is set to `asciidoc document` and so on.

Compatible formats for customized content are:

- `asciidoc document`
- `asciidoc table`
- `markdown document`
- `markdown table`

Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2021-05-12 16:12:38 -04:00
Khosrow Moossavi
e31d3de84b Bump plugin-sdk to v0.3.0
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2021-04-30 16:17:08 -04:00
Khosrow Moossavi
fcd314b13b Read config from relative path, absolute, or $HOME
Configuration can be loaded with `-c, --config string` which accepts
both relative and absolute paths.

    $ pwd
    /path/to/parent/folder

    $ tree
    .
    ├── module-a
    │   └── main.tf
    ├── module-b
    │   └── main.tf
    ├── ...
    └── .terraform-docs.yml

    # executing from parent
    $ terraform-docs -c .terraform-docs.yml module-a/

    # executing from child
    $ cd module-a/
    $ terraform-docs -c ../.terraform-docs.yml .

    # or an absolute path
    $ terraform-docs -c /path/to/parent/folder/.terraform-docs.yml .

The order for looking for config file is:

1. root of module directory
2. current directory
3. `$HOME/.tfdocs.d/`

if `.terraform-docs.yml` is found in any of the folders above, that will
take precedence and will override the other ones. Note that values passed
directly as CLI flags will override all of the above.

Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2021-04-30 13:59:44 -04:00
Khosrow Moossavi
dabf54f29f Version constraints configuration
terraform-docs version constraints is almost identical to the syntax
used by Terraform. A version constraint is a string literal containing
one or more condition, which are separated by commas.

```yaml
version: ">= 0.13.0, < 1.0.0"
```

Each condition consists of an operator and a version number. A version
number is a series of numbers separated by dots (e.g. `0.13.0`). Note
that version number should not have leading `v` in it.

Valid operators are as follow:

- `=` (or no operator): allows for exact version number.
- `!=`: exclude an exact version number.
- `>`, `>=`, `<`, and `<=`: comparisons against a specific version.
- `~>`: only the rightmost version component to increment.

Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2021-04-26 19:45:34 -04:00
Adam Johnson
a26111fe95 Add support for configuration_aliases
Signed-off-by: Adam Johnson <adamjohnson01@gmail.com>
2021-04-20 12:27:13 +01:00
Khosrow Moossavi
e2e7a61ad7 Add ShowDescription to Settings
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2021-04-16 11:29:45 -04:00
Edgar R. Sandi
c8fc7ab4f2 add ability to show or hide data-sources
Signed-off-by: Edgar R. Sandi <edgar.r.sandi@gmail.com>
2021-04-14 17:36:55 -03:00
Khosrow Moossavi
d6b284806c Bump plugin-sdk to v0.2.0
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2021-03-22 14:33:01 -04:00
Khosrow Moossavi
ac5a29c6f6 Implement module sort by position (no sort)
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2021-03-15 18:26:54 -04:00
Simon Clifford
aa1e6bbf59 Add support for footer docs
Enables a footer to be appended to the end of a generated document
sourced from tf files or documents in the same way as the header

Adds the `footer-from` field to the config yml
Adds the `--footer-from` flag to the cli

Signed-off-by: Simon Clifford <siclifford@gmail.com>
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2021-03-15 14:51:00 -04:00
Edgar R. Sandi
8c05cb9b17 Add resource 'Name' to generated docs
Signed-off-by: Edgar R. Sandi <edgar.r.sandi@gmail.com>
2021-03-09 15:11:39 -03:00
Khosrow Moossavi
3d39a94e39 Add option to hide Type and Default columns
Two new flags are added: '--default bool' and '--type bool' to
control the visibility of Default and Type columns and section
respectively in Markdown and AsciiDoc.

Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2021-03-02 14:17:03 -05:00
Khosrow Moossavi
9203104476 Upgrade staticcheck to v0.1.2
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2021-02-23 17:25:03 -05:00
Khosrow Moossavi
cee4b770ce Upgrade go vendor dependencies
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2021-02-17 13:27:58 -05:00
Khosrow Moossavi
1c5a2eea36 Bump plugin-sdk to v0.1.0
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2021-02-10 17:14:13 -05:00
Heiko Neblung
2575a40e78 added output section for modulecalls
Signed-off-by: Heiko Neblung <Heiko.Neblung@t-systems.com>
2021-02-10 05:40:50 +01:00
Khosrow Moossavi
54fc067bf4 Add support for plugin execution
Plugin can be developed on top of terraform-docs/plugin-sdk and made
available to terraform-docs core project in:

- ~/.tfdocs.d/plugins/ or
- ./.tfdocs.d/plugins/ (this takes precedence if exists)

Refer to the following for more details and examples:

- https://github.com/terraform-docs/plugin-sdk
- https://github.com/terraform-docs/tfdocs-format-template

Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2021-02-02 18:27:04 -05:00
Khosrow Moossavi
e3a19ea9dd Move pkg/tfconf to internal/terraform
Originally pkg/tfconf was set to be public to be used by plugin
developers, but these structs have to be defined by plugin-sdk and as
such it's moved to internal/terraform to be only used by terraform-docs
core project.

Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2021-01-26 15:39:30 -05:00
Khosrow Moossavi
37b9faaf30 Move internal/tfconfig out of tree
Originally we in-tree forked hashicorp/terraform-config-inspect project
due to it being stalled and we depended on a fix upstream. But now that
seems to be resolved and they've added the feature we were looking for
in upstream.

Although, to prevent future dependency lock, we went ahead and forked
the project under terraform-docs organization and will be using that,
which at this point is identical to upstream and we don have any reason
to believe that changes anytime soon too.

Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2021-01-26 10:44:34 -05:00
dependabot[bot]
7be58e6f0c build: bump github.com/hashicorp/hcl/v2 from 2.8.0 to 2.8.1 (#359)
Bumps [github.com/hashicorp/hcl/v2](https://github.com/hashicorp/hcl) from 2.8.0 to 2.8.1.
- [Release notes](https://github.com/hashicorp/hcl/releases)
- [Changelog](https://github.com/hashicorp/hcl/blob/v2.8.1/CHANGELOG.md)
- [Commits](https://github.com/hashicorp/hcl/compare/v2.8.0...v2.8.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-18 16:17:36 -05:00
dependabot[bot]
a0050f8e72 build: bump github.com/zclconf/go-cty from 1.7.0 to 1.7.1 (#357)
Bumps [github.com/zclconf/go-cty](https://github.com/zclconf/go-cty) from 1.7.0 to 1.7.1.
- [Release notes](https://github.com/zclconf/go-cty/releases)
- [Changelog](https://github.com/zclconf/go-cty/blob/main/CHANGELOG.md)
- [Commits](https://github.com/zclconf/go-cty/compare/v1.7.0...v1.7.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-18 16:15:26 -05:00
dependabot[bot]
2eab30cc2b build: bump github.com/hashicorp/hcl/v2 from 2.7.0 to 2.8.0 (#353)
Bumps [github.com/hashicorp/hcl/v2](https://github.com/hashicorp/hcl) from 2.7.0 to 2.8.0.
- [Release notes](https://github.com/hashicorp/hcl/releases)
- [Changelog](https://github.com/hashicorp/hcl/blob/v2.8.0/CHANGELOG.md)
- [Commits](https://github.com/hashicorp/hcl/compare/v2.7.0...v2.8.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-12-09 17:17:59 -05:00
dependabot[bot]
50595de0f2 build: bump github.com/zclconf/go-cty from 1.6.1 to 1.7.0 (#341)
Bumps [github.com/zclconf/go-cty](https://github.com/zclconf/go-cty) from 1.6.1 to 1.7.0.
- [Release notes](https://github.com/zclconf/go-cty/releases)
- [Changelog](https://github.com/zclconf/go-cty/blob/main/CHANGELOG.md)
- [Commits](https://github.com/zclconf/go-cty/compare/v1.6.1...v1.7.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-10-21 11:33:48 -04:00
dependabot[bot]
5bc452a37d build: bump github.com/spf13/cobra from 1.1.0 to 1.1.1 (#340)
Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.1.0 to 1.1.1.
- [Release notes](https://github.com/spf13/cobra/releases)
- [Changelog](https://github.com/spf13/cobra/blob/master/CHANGELOG.md)
- [Commits](https://github.com/spf13/cobra/compare/v1.1.0...v1.1.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-10-19 09:15:56 -04:00
Khosrow Moossavi
2353afbcae fix: Never escape special characters in tfvars json (#339)
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2020-10-16 18:54:47 -04:00
Khosrow Moossavi
5433d6b848 build: bump gopkg.in/yaml.v3 to v3.0.0-20200615113413-eeeca48fe776 (#337) 2020-10-15 19:04:37 -04:00
dependabot[bot]
329ef42c2e build: bump github.com/hashicorp/hcl/v2 from 2.6.0 to 2.7.0 (#334)
Bumps [github.com/hashicorp/hcl/v2](https://github.com/hashicorp/hcl) from 2.6.0 to 2.7.0.
- [Release notes](https://github.com/hashicorp/hcl/releases)
- [Changelog](https://github.com/hashicorp/hcl/blob/v2.7.0/CHANGELOG.md)
- [Commits](https://github.com/hashicorp/hcl/compare/v2.6.0...v2.7.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-10-15 18:58:27 -04:00
dependabot[bot]
e3e81c2521 build: bump github.com/spf13/cobra from 1.0.0 to 1.1.0 (#335)
Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.0.0 to 1.1.0.
- [Release notes](https://github.com/spf13/cobra/releases)
- [Changelog](https://github.com/spf13/cobra/blob/master/CHANGELOG.md)
- [Commits](https://github.com/spf13/cobra/compare/v1.0.0...v1.1.0)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-10-15 18:53:32 -04:00
dependabot[bot]
d6e8352c79 build: bump github.com/zclconf/go-cty from 1.6.0 to 1.6.1 (#321)
* build: bump github.com/zclconf/go-cty from 1.6.0 to 1.6.1

Bumps [github.com/zclconf/go-cty](https://github.com/zclconf/go-cty) from 1.6.0 to 1.6.1.
- [Release notes](https://github.com/zclconf/go-cty/releases)
- [Changelog](https://github.com/zclconf/go-cty/blob/master/CHANGELOG.md)
- [Commits](https://github.com/zclconf/go-cty/compare/v1.6.0...v1.6.1)

Signed-off-by: dependabot[bot] <support@github.com>

* go mod tidy

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Khosrow Moossavi <khos2ow@gmail.com>
2020-09-04 10:47:45 -04:00
dependabot-preview[bot]
e9cd8aa774 build(deps): bump github.com/zclconf/go-cty from 1.5.1 to 1.6.0 (#316)
* build(deps): bump github.com/zclconf/go-cty from 1.5.1 to 1.6.0

Bumps [github.com/zclconf/go-cty](https://github.com/zclconf/go-cty) from 1.5.1 to 1.6.0.
- [Release notes](https://github.com/zclconf/go-cty/releases)
- [Changelog](https://github.com/zclconf/go-cty/blob/master/CHANGELOG.md)
- [Commits](https://github.com/zclconf/go-cty/compare/v1.5.1...v1.6.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* go mod tidy

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Khosrow Moossavi <khos2ow@gmail.com>
2020-09-01 14:55:55 -04:00
dependabot-preview[bot]
c531384455 build(deps): bump github.com/imdario/mergo from 0.3.10 to 0.3.11 (#306)
* build(deps): bump github.com/imdario/mergo from 0.3.10 to 0.3.11

Bumps [github.com/imdario/mergo](https://github.com/imdario/mergo) from 0.3.10 to 0.3.11.
- [Release notes](https://github.com/imdario/mergo/releases)
- [Commits](https://github.com/imdario/mergo/compare/v0.3.10...v0.3.11)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* go mod tidy

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Khosrow Moossavi <khos2ow@gmail.com>
2020-08-12 19:51:44 -04:00