Merge pull request #29 from Lerentis/dependabot/go_modules/github.com/hashicorp/terraform-plugin-docs-0.14.1

This commit is contained in:
Tobias Trabelsi 2023-03-21 16:09:50 +01:00 committed by GitHub
commit 1162650a73
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 64 additions and 79 deletions

6
go.mod
View file

@ -4,7 +4,7 @@ go 1.18
require (
code.gitea.io/sdk/gitea v0.15.1
github.com/hashicorp/terraform-plugin-docs v0.13.0
github.com/hashicorp/terraform-plugin-docs v0.14.1
github.com/hashicorp/terraform-plugin-sdk/v2 v2.26.0
)
@ -41,8 +41,8 @@ require (
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect
github.com/huandu/xstrings v1.3.2 // indirect
github.com/imdario/mergo v0.3.13 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/mitchellh/cli v1.1.5 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect

11
go.sum
View file

@ -118,8 +118,8 @@ github.com/hashicorp/terraform-exec v0.18.1 h1:LAbfDvNQU1l0NOQlTuudjczVhHj061fNX
github.com/hashicorp/terraform-exec v0.18.1/go.mod h1:58wg4IeuAJ6LVsLUeD2DWZZoc/bYi6dzhLHzxM41980=
github.com/hashicorp/terraform-json v0.16.0 h1:UKkeWRWb23do5LNAFlh/K3N0ymn1qTOO8c+85Albo3s=
github.com/hashicorp/terraform-json v0.16.0/go.mod h1:v0Ufk9jJnk6tcIZvScHvetlKfiNTC+WS21mnXIlc0B0=
github.com/hashicorp/terraform-plugin-docs v0.13.0 h1:6e+VIWsVGb6jYJewfzq2ok2smPzZrt1Wlm9koLeKazY=
github.com/hashicorp/terraform-plugin-docs v0.13.0/go.mod h1:W0oCmHAjIlTHBbvtppWHe8fLfZ2BznQbuv8+UD8OucQ=
github.com/hashicorp/terraform-plugin-docs v0.14.1 h1:MikFi59KxrP/ewrZoaowrB9he5Vu4FtvhamZFustiA4=
github.com/hashicorp/terraform-plugin-docs v0.14.1/go.mod h1:k2NW8+t113jAus6bb5tQYQgEAX/KueE/u8X2Z45V1GM=
github.com/hashicorp/terraform-plugin-go v0.14.3 h1:nlnJ1GXKdMwsC8g1Nh05tK2wsC3+3BL/DBBxFEki+j0=
github.com/hashicorp/terraform-plugin-go v0.14.3/go.mod h1:7ees7DMZ263q8wQ6E4RdIdR6nHHJtrdt4ogX5lPkX1A=
github.com/hashicorp/terraform-plugin-log v0.8.0 h1:pX2VQ/TGKu+UU1rCay0OlzosNKe4Nz1pepLXj95oyy0=
@ -158,12 +158,14 @@ github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0
github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40=
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mitchellh/cli v1.1.5 h1:OxRIeJXpAMztws/XHlN2vu6imG5Dpq+j61AzAX5fLng=
github.com/mitchellh/cli v1.1.5/go.mod h1:v8+iFts2sPIKUV1ltktPXMCC8fumSKFItNcD2cLtRR4=
github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw=
@ -292,6 +294,7 @@ golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=

View file

@ -1,3 +1,5 @@
Copyright (c) 2020 HashiCorp, Inc.
Mozilla Public License Version 2.0
==================================

View file

@ -42,7 +42,7 @@ func (cmd *generateCmd) Help() string {
}
})
strBuilder.WriteString(fmt.Sprintf("\nUsage: tfplugindocs generate [<args>]\n\n"))
strBuilder.WriteString("\nUsage: tfplugindocs generate [<args>]\n\n")
cmd.Flags().VisitAll(func(f *flag.Flag) {
if f.DefValue != "" {
strBuilder.WriteString(fmt.Sprintf(" --%s <ARG> %s%s%s (default: %q)\n",

View file

@ -30,7 +30,7 @@ func (cmd *validateCmd) Help() string {
}
})
strBuilder.WriteString(fmt.Sprintf("\nUsage: tfplugindocs validate [<args>]\n\n"))
strBuilder.WriteString("\nUsage: tfplugindocs validate [<args>]\n\n")
cmd.Flags().VisitAll(func(f *flag.Flag) {
if f.DefValue != "" {
strBuilder.WriteString(fmt.Sprintf(" --%s <ARG> %s%s%s (default: %q)\n",

View file

@ -130,13 +130,9 @@ func (options *Text) Emphasis(out *bytes.Buffer, text []byte) {
out.Write(text)
}
func (options *Text) Image(out *bytes.Buffer, link []byte, title []byte, alt []byte) {
return
}
func (options *Text) Image(out *bytes.Buffer, link []byte, title []byte, alt []byte) {}
func (options *Text) LineBreak(out *bytes.Buffer) {
return
}
func (options *Text) LineBreak(out *bytes.Buffer) {}
func (options *Text) Link(out *bytes.Buffer, link []byte, title []byte, content []byte) {
out.Write(content)
@ -144,12 +140,9 @@ func (options *Text) Link(out *bytes.Buffer, link []byte, title []byte, content
out.WriteString(" ")
out.Write(link)
}
return
}
func (options *Text) RawHtmlTag(out *bytes.Buffer, text []byte) {
return
}
func (options *Text) RawHtmlTag(out *bytes.Buffer, text []byte) {}
func (options *Text) TripleEmphasis(out *bytes.Buffer, text []byte) {
out.Write(text)
@ -159,9 +152,7 @@ func (options *Text) StrikeThrough(out *bytes.Buffer, text []byte) {
out.Write(text)
}
func (options *Text) FootnoteRef(out *bytes.Buffer, ref []byte, id int) {
return
}
func (options *Text) FootnoteRef(out *bytes.Buffer, ref []byte, id int) {}
func (options *Text) Entity(out *bytes.Buffer, entity []byte) {
out.Write(entity)
@ -171,25 +162,15 @@ func (options *Text) NormalText(out *bytes.Buffer, text []byte) {
out.Write(text)
}
func (options *Text) Smartypants(out *bytes.Buffer, text []byte) {
return
}
func (options *Text) Smartypants(out *bytes.Buffer, text []byte) {}
func (options *Text) DocumentHeader(out *bytes.Buffer) {
return
}
func (options *Text) DocumentHeader(out *bytes.Buffer) {}
func (options *Text) DocumentFooter(out *bytes.Buffer) {
return
}
func (options *Text) DocumentFooter(out *bytes.Buffer) {}
func (options *Text) TocHeader(text []byte, level int) {
return
}
func (options *Text) TocHeader(text []byte, level int) {}
func (options *Text) TocFinalize() {
return
}
func (options *Text) TocFinalize() {}
func doubleSpace(out *bytes.Buffer) {
if out.Len() > 0 {

View file

@ -3,7 +3,6 @@ package provider
import (
"context"
"fmt"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
@ -128,7 +127,7 @@ func (g *generator) Generate(ctx context.Context) error {
switch {
case g.websiteTmpDir == "":
g.websiteTmpDir, err = ioutil.TempDir("", "tfws")
g.websiteTmpDir, err = os.MkdirTemp("", "tfws")
if err != nil {
return err
}
@ -249,7 +248,7 @@ func (g *generator) renderMissingResourceDoc(providerName, name, typeName string
fallbackTmplPath = filepath.Join(g.websiteTmpDir, g.websiteSourceDir, fallbackTmplPath)
if fileExists(fallbackTmplPath) {
g.infof("resource %q fallback template exists", name)
tmplData, err := ioutil.ReadFile(fallbackTmplPath)
tmplData, err := os.ReadFile(fallbackTmplPath)
if err != nil {
return fmt.Errorf("unable to read file %q: %w", fallbackTmplPath, err)
}
@ -377,7 +376,7 @@ func (g *generator) renderStaticWebsite(providerName string, providerSchema *tfj
g.infof("rendering templated website to static markdown")
err = filepath.Walk(g.websiteTmpDir, func(path string, info os.FileInfo, err error) error {
err = filepath.Walk(g.websiteTmpDir, func(path string, info os.FileInfo, _ error) error {
if info.IsDir() {
// skip directories
return nil
@ -410,7 +409,7 @@ func (g *generator) renderStaticWebsite(providerName string, providerSchema *tfj
renderedPath = strings.TrimSuffix(renderedPath, ext)
tmplData, err := ioutil.ReadFile(path)
tmplData, err := os.ReadFile(path)
if err != nil {
return fmt.Errorf("unable to read file %q: %w", rel, err)
}
@ -492,7 +491,7 @@ func (g *generator) terraformProviderSchema(ctx context.Context, providerName st
shortName := providerShortName(providerName)
tmpDir, err := ioutil.TempDir("", "tfws")
tmpDir, err := os.MkdirTemp("", "tfws")
if err != nil {
return nil, err
}

View file

@ -3,7 +3,6 @@ package provider
import (
"fmt"
"io"
"io/ioutil"
"log"
"os"
"os/exec"
@ -78,7 +77,7 @@ func writeFile(path string, data string) error {
return fmt.Errorf("unable to make dir %q: %w", dir, err)
}
err = ioutil.WriteFile(path, []byte(data), 0644)
err = os.WriteFile(path, []byte(data), 0644)
if err != nil {
return fmt.Errorf("unable to write file %q: %w", path, err)
}
@ -90,7 +89,7 @@ func runCmd(cmd *exec.Cmd) ([]byte, error) {
output, err := cmd.CombinedOutput()
if err != nil {
log.Printf("error executing %q, %v", cmd.Path, cmd.Args)
log.Printf(string(output))
log.Print(string(output))
return nil, fmt.Errorf("error executing %q: %w", cmd.Path, err)
}
return output, nil

View file

@ -2,7 +2,6 @@ package tmplfuncs
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
@ -21,7 +20,7 @@ func CodeFile(format, file string) (string, error) {
}
fullPath := filepath.Join(wd, file)
content, err := ioutil.ReadFile(fullPath)
content, err := os.ReadFile(fullPath)
if err != nil {
return "", fmt.Errorf("unable to read content from %q: %w", file, err)
}

View file

@ -12,11 +12,12 @@ import (
// Render writes a Markdown formatted Schema definition to the specified writer.
// A Schema contains a Version and the root Block, for example:
// "aws_accessanalyzer_analyzer": {
// "block": {
// },
// "version": 0
// },
//
// "aws_accessanalyzer_analyzer": {
// "block": {
// },
// "version": 0
// },
func Render(schema *tfjson.Schema, w io.Writer) error {
_, err := io.WriteString(w, "## Schema\n\n")
if err != nil {
@ -178,26 +179,27 @@ func writeRootBlock(w io.Writer, block *tfjson.SchemaBlock) error {
// * Description(Kind)
// * Deprecated flag
// For example:
// "block": {
// "attributes": {
// "certificate_arn": {
// "description_kind": "plain",
// "required": true,
// "type": "string"
// }
// },
// "block_types": {
// "timeouts": {
// "block": {
// "attributes": {
// },
// "description_kind": "plain"
// },
// "nesting_mode": "single"
// }
// },
// "description_kind": "plain"
// },
//
// "block": {
// "attributes": {
// "certificate_arn": {
// "description_kind": "plain",
// "required": true,
// "type": "string"
// }
// },
// "block_types": {
// "timeouts": {
// "block": {
// "attributes": {
// },
// "description_kind": "plain"
// },
// "nesting_mode": "single"
// }
// },
// "description_kind": "plain"
// },
func writeBlockChildren(w io.Writer, parents []string, block *tfjson.SchemaBlock, root bool) error {
names := []string{}
for n := range block.Attributes {

12
vendor/modules.txt vendored
View file

@ -108,8 +108,8 @@ github.com/hashicorp/terraform-exec/tfexec
# github.com/hashicorp/terraform-json v0.16.0
## explicit; go 1.18
github.com/hashicorp/terraform-json
# github.com/hashicorp/terraform-plugin-docs v0.13.0
## explicit; go 1.17
# github.com/hashicorp/terraform-plugin-docs v0.14.1
## explicit; go 1.18
github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs
github.com/hashicorp/terraform-plugin-docs/internal/cmd
github.com/hashicorp/terraform-plugin-docs/internal/mdplain
@ -176,11 +176,11 @@ github.com/huandu/xstrings
# github.com/imdario/mergo v0.3.13
## explicit; go 1.13
github.com/imdario/mergo
# github.com/mattn/go-colorable v0.1.12
## explicit; go 1.13
# github.com/mattn/go-colorable v0.1.13
## explicit; go 1.15
github.com/mattn/go-colorable
# github.com/mattn/go-isatty v0.0.14
## explicit; go 1.12
# github.com/mattn/go-isatty v0.0.16
## explicit; go 1.15
github.com/mattn/go-isatty
# github.com/mitchellh/cli v1.1.5
## explicit; go 1.11