Commit Graph

6 Commits

Author SHA1 Message Date
Pascal Hofmann
dd450a5352 chore: fix golangci-lint issues
Signed-off-by: Pascal Hofmann <mail@pascalhofmann.de>
2025-12-12 14:43:23 +01: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
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
4397facaff Validate license header on files on CI
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2021-04-30 20:09:12 -04:00
Khosrow Moossavi
3cc4f4416f Fix issues reported by golangci-lint
Signed-off-by: Khosrow Moossavi <khos2ow@gmail.com>
2021-03-16 17:33:10 -04: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