diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 92cd4b6..66c5681 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,7 +13,7 @@ jobs: name: go mod runs-on: ubuntu-latest steps: - - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 with: go-version-file: 'go.mod' @@ -26,7 +26,7 @@ jobs: name: go test runs-on: ubuntu-latest steps: - - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 with: go-version-file: 'go.mod' @@ -36,7 +36,7 @@ jobs: needs: [go_mod, go_test] runs-on: ubuntu-latest steps: - - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 with: fetch-depth: 0 - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 @@ -55,11 +55,11 @@ jobs: run: | sed -n -e "1{/# v/d;}" -e "2{/^$/d;}" -e "/# $(git describe --abbrev=0 --exclude="$(git describe --abbrev=0 --match='v*.*.*' --tags)" --match='v*.*.*' --tags)/q;p" CHANGELOG.md > RELEASE-NOTES.md - name: goreleaser check - uses: goreleaser/goreleaser-action@f82d6c1c344bcacabba2c841718984797f664a6b # v4.2.0 + uses: goreleaser/goreleaser-action@336e29918d653399e599bfca99fadc1d7ffbc9f7 # v4.3.0 with: args: check - name: goreleaser release - uses: goreleaser/goreleaser-action@f82d6c1c344bcacabba2c841718984797f664a6b # v4.2.0 + uses: goreleaser/goreleaser-action@336e29918d653399e599bfca99fadc1d7ffbc9f7 # v4.3.0 env: GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }} GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0b845d8..edced9f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,7 +6,7 @@ jobs: name: go mod runs-on: ubuntu-latest steps: - - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 with: go-version-file: 'go.mod' @@ -20,7 +20,7 @@ jobs: name: go test runs-on: ubuntu-latest steps: - - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 with: go-version-file: 'go.mod' @@ -29,7 +29,7 @@ jobs: name: goreleaser runs-on: ubuntu-latest steps: - - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1 with: go-version-file: 'go.mod' diff --git a/.goreleaser.yml b/.goreleaser.yml index 4d554ac..03556e8 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -12,10 +12,10 @@ brews: - go description: Terraform Provider Documentation Tool folder: Formula - tap: - owner: bflad + repository: + owner: YakDriver name: homebrew-tap - homepage: https://github.com/bflad/tfproviderdocs + homepage: https://github.com/YakDriver/tfproviderdocs install: | bin.install "tfproviderdocs" test: | @@ -33,7 +33,7 @@ builds: - arm64 - 386 ldflags: - - -s -w -X github.com/bflad/tfproviderdocs/version.Version={{.Version}} -X github.com/bflad/tfproviderdocs/version.VersionPrerelease= + - -s -w -X github.com/YakDriver/tfproviderdocs/version.Version={{.Version}} -X github.com/YakDriver/tfproviderdocs/version.VersionPrerelease= main: . changelog: skip: true @@ -44,9 +44,9 @@ dockers: - "--label=org.label-schema.version={{.Version}}" - "--label=org.label-schema.name={{.ProjectName}}" image_templates: - - 'bflad/tfproviderdocs:{{ .Version }}' - - 'bflad/tfproviderdocs:{{ .Major }}.{{ .Minor }}' - - 'bflad/tfproviderdocs:latest' + - 'YakDriver/tfproviderdocs:{{ .Version }}' + - 'YakDriver/tfproviderdocs:{{ .Major }}.{{ .Minor }}' + - 'YakDriver/tfproviderdocs:latest' milestones: - close: true diff --git a/README.md b/README.md index 4ece90d..5705124 100644 --- a/README.md +++ b/README.md @@ -6,24 +6,24 @@ A documentation tool for [Terraform Provider](https://www.terraform.io/docs/prov ### Local Install -Release binaries are available in the [Releases](https://github.com/bflad/tfproviderdocs/releases) section. +Release binaries are available in the [Releases](https://github.com/YakDriver/tfproviderdocs/releases) section. To instead use Go to install into your `$GOBIN` directory (e.g. `$GOPATH/bin`): ```shell -go install github.com/bflad/tfproviderdocs +go install github.com/YakDriver/tfproviderdocs ``` ### Docker Install ```shell -docker pull bflad/tfproviderdocs +docker pull YakDriver/tfproviderdocs ``` ### Homebrew Install ```shell -brew install bflad/tap/tfproviderdocs +brew install YakDriver/tap/tfproviderdocs ``` ## Usage @@ -47,7 +47,7 @@ tfproviderdocs Change into the directory of the Terraform Provider code and run: ```shell -docker run -v $(pwd):/src bflad/tfproviderdocs +docker run -v $(pwd):/src YakDriver/tfproviderdocs ``` ## Available Commands diff --git a/check/check.go b/check/check.go index f87350d..cdcf607 100644 --- a/check/check.go +++ b/check/check.go @@ -4,7 +4,7 @@ import ( "fmt" "sort" - "github.com/bflad/tfproviderdocs/markdown" + "github.com/YakDriver/tfproviderdocs/markdown" "github.com/hashicorp/go-multierror" ) diff --git a/check/contents.go b/check/contents.go index 3b89774..006836d 100644 --- a/check/contents.go +++ b/check/contents.go @@ -3,7 +3,7 @@ package check import ( "fmt" - "github.com/bflad/tfproviderdocs/check/contents" + "github.com/YakDriver/tfproviderdocs/check/contents" ) type ContentsCheck struct { diff --git a/check/contents/check_attributes_section.go b/check/contents/check_attributes_section.go index 66bbcae..99d20dc 100644 --- a/check/contents/check_attributes_section.go +++ b/check/contents/check_attributes_section.go @@ -19,43 +19,48 @@ func (d *Document) checkAttributesSection() error { section := d.Sections.Attributes if section == nil { - return fmt.Errorf("missing attributes section: ## Attributes Reference") + return fmt.Errorf("missing attribute section: ## Attribute Reference") } heading := section.Heading if heading.Level != 2 { - return fmt.Errorf("attributes section heading level (%d) should be: 2", heading.Level) + return fmt.Errorf("attribute section heading level (%d) should be: 2", heading.Level) } headingText := string(heading.Text(d.source)) - expectedHeadingText := "Attributes Reference" + expectedHeadingTexts := []string{ + "Attribute Reference", + "Attributes Reference", + } - if headingText != expectedHeadingText { - return fmt.Errorf("attributes section heading (%s) should be: %s", headingText, expectedHeadingText) + if headingText != expectedHeadingTexts[0] && headingText != expectedHeadingTexts[1] { + return fmt.Errorf("attribute section heading (%s) should be: %q (preferred) or %q", headingText, expectedHeadingTexts[0], expectedHeadingTexts[1]) } paragraphs := section.Paragraphs expectedBylineTexts := []string{ + "This resource exports the following attributes in addition to the arguments above:", + "This data source exports the following attributes in addition to the arguments above:", "In addition to all arguments above, the following attributes are exported:", "No additional attributes are exported.", } switch len(paragraphs) { case 0: - return fmt.Errorf("attributes section byline should be: %q or %q", expectedBylineTexts[0], expectedBylineTexts[1]) + return fmt.Errorf("attribute section byline should be: %q, %q, %q, or %q", expectedBylineTexts[0], expectedBylineTexts[1], expectedBylineTexts[2], expectedBylineTexts[3]) case 1: paragraphText := string(paragraphs[0].Text(d.source)) - if paragraphText != expectedBylineTexts[0] && paragraphText != expectedBylineTexts[1] { - return fmt.Errorf("attributes section byline (%s) should be: %q or %q", paragraphText, expectedBylineTexts[0], expectedBylineTexts[1]) + if paragraphText != expectedBylineTexts[0] && paragraphText != expectedBylineTexts[1] && paragraphText != expectedBylineTexts[2] && paragraphText != expectedBylineTexts[3] { + return fmt.Errorf("attribute section byline (%s) should be: %q, %q, %q, or %q", paragraphText, expectedBylineTexts[0], expectedBylineTexts[1], expectedBylineTexts[2], expectedBylineTexts[3]) } } if checkOpts.RequireSchemaOrdering { for _, list := range section.SchemaAttributeLists { if !sort.IsSorted(SchemaAttributeListItemByName(list.Items)) { - return fmt.Errorf("attributes section is not sorted by name") + return fmt.Errorf("attribute section is not sorted by name") } } } diff --git a/check/contents/check_example_section.go b/check/contents/check_example_section.go index 4e418f9..860e6ee 100644 --- a/check/contents/check_example_section.go +++ b/check/contents/check_example_section.go @@ -4,7 +4,7 @@ import ( "fmt" "strings" - "github.com/bflad/tfproviderdocs/markdown" + "github.com/YakDriver/tfproviderdocs/markdown" ) type CheckExamplesSectionOptions struct { diff --git a/check/contents/check_import_section.go b/check/contents/check_import_section.go index b8f753e..fea7218 100644 --- a/check/contents/check_import_section.go +++ b/check/contents/check_import_section.go @@ -4,7 +4,7 @@ import ( "fmt" "strings" - "github.com/bflad/tfproviderdocs/markdown" + "github.com/YakDriver/tfproviderdocs/markdown" ) func (d *Document) checkImportSection() error { diff --git a/check/contents/document.go b/check/contents/document.go index cf87173..4e9adbc 100644 --- a/check/contents/document.go +++ b/check/contents/document.go @@ -6,7 +6,7 @@ import ( "path/filepath" "strings" - "github.com/bflad/tfproviderdocs/markdown" + "github.com/YakDriver/tfproviderdocs/markdown" "github.com/yuin/goldmark/ast" ) diff --git a/check/directory.go b/check/directory.go index cd4fea2..2d29fca 100644 --- a/check/directory.go +++ b/check/directory.go @@ -112,6 +112,11 @@ func NumberOfFilesCheck(directories map[string][]string) error { var numberOfFiles int for directory, files := range directories { + // Ignore CDKTF files. The file limit is per-language and presumably there is one CDKTF file per source HCL file. + if IsValidCdktfDirectory(directory) { + continue + } + directoryNumberOfFiles := len(files) log.Printf("[TRACE] Found %d documentation files in directory: %s", directoryNumberOfFiles, directory) numberOfFiles = numberOfFiles + directoryNumberOfFiles diff --git a/check/legacy_resource_file.go b/check/legacy_resource_file.go index cd55ead..fa89e5a 100644 --- a/check/legacy_resource_file.go +++ b/check/legacy_resource_file.go @@ -4,6 +4,7 @@ import ( "fmt" "log" "os" + "path/filepath" "github.com/hashicorp/go-multierror" ) @@ -58,6 +59,11 @@ func NewLegacyResourceFileCheck(opts *LegacyResourceFileOptions) *LegacyResource func (check *LegacyResourceFileCheck) Run(path string, exampleLanguage string) error { fullpath := check.Options.FullPath(path) + // skip cdktf directories + if IsValidCdktfDirectory(path) { + return nil + } + log.Printf("[DEBUG] Checking file: %s", fullpath) if err := LegacyFileExtensionCheck(path); err != nil { @@ -78,10 +84,12 @@ func (check *LegacyResourceFileCheck) Run(path string, exampleLanguage string) e return fmt.Errorf("%s: error checking file frontmatter: %w", path, err) } - if err := NewContentsCheck(check.Options.Contents).Run(fullpath, exampleLanguage); err != nil { - return fmt.Errorf("%s: error checking file contents: %w", path, err) + // We don't want to check the content for CDKTF files since they are converted + if !IsValidCdktfDirectory(filepath.Dir(fullpath)) { + if err := NewContentsCheck(check.Options.Contents).Run(fullpath, exampleLanguage); err != nil { + return fmt.Errorf("%s: error checking file contents: %w", path, err) + } } - return nil } diff --git a/check/registry_resource_file.go b/check/registry_resource_file.go index 15e31a9..caccc37 100644 --- a/check/registry_resource_file.go +++ b/check/registry_resource_file.go @@ -4,6 +4,7 @@ import ( "fmt" "log" "os" + "path/filepath" "github.com/hashicorp/go-multierror" ) @@ -76,10 +77,12 @@ func (check *RegistryResourceFileCheck) Run(path string, exampleLanguage string) return fmt.Errorf("%s: error checking file frontmatter: %w", path, err) } - if err := NewContentsCheck(check.Options.Contents).Run(fullpath, exampleLanguage); err != nil { - return fmt.Errorf("%s: error checking file contents: %w", path, err) + // We don't want to check the content for CDKTF files since they are converted + if !IsValidCdktfDirectory(filepath.Dir(fullpath)) { + if err := NewContentsCheck(check.Options.Contents).Run(fullpath, exampleLanguage); err != nil { + return fmt.Errorf("%s: error checking file contents: %w", path, err) + } } - return nil } diff --git a/command/check.go b/command/check.go index e2c54ec..384cd9c 100644 --- a/command/check.go +++ b/command/check.go @@ -13,7 +13,7 @@ import ( "strings" "text/tabwriter" - "github.com/bflad/tfproviderdocs/check" + "github.com/YakDriver/tfproviderdocs/check" tfjson "github.com/hashicorp/terraform-json" "github.com/mitchellh/cli" ) diff --git a/command/commands.go b/command/commands.go index 8b88a7b..1f83750 100644 --- a/command/commands.go +++ b/command/commands.go @@ -1,7 +1,7 @@ package command import ( - "github.com/bflad/tfproviderdocs/version" + "github.com/YakDriver/tfproviderdocs/version" "github.com/mitchellh/cli" ) diff --git a/command/version.go b/command/version.go index b69117e..ff8b7bd 100644 --- a/command/version.go +++ b/command/version.go @@ -1,7 +1,7 @@ package command import ( - "github.com/bflad/tfproviderdocs/version" + "github.com/YakDriver/tfproviderdocs/version" "github.com/mitchellh/cli" ) diff --git a/go.mod b/go.mod index 56d8761..1b357bb 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/bflad/tfproviderdocs +module github.com/YakDriver/tfproviderdocs go 1.19 @@ -6,7 +6,7 @@ require ( github.com/bmatcuk/doublestar v1.3.4 github.com/hashicorp/go-hclog v1.5.0 github.com/hashicorp/go-multierror v1.1.1 - github.com/hashicorp/terraform-json v0.16.0 + github.com/hashicorp/terraform-json v0.17.1 github.com/mattn/go-colorable v0.1.13 github.com/mitchellh/cli v1.1.5 github.com/yuin/goldmark v1.5.4 @@ -33,7 +33,7 @@ require ( github.com/posener/complete v1.1.1 // indirect github.com/shopspring/decimal v1.2.0 // indirect github.com/spf13/cast v1.3.1 // indirect - github.com/zclconf/go-cty v1.13.0 // indirect + github.com/zclconf/go-cty v1.13.2 // indirect golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a // indirect golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab // indirect golang.org/x/text v0.3.8 // indirect diff --git a/go.sum b/go.sum index feffe87..68529ba 100644 --- a/go.sum +++ b/go.sum @@ -31,8 +31,8 @@ github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+l github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -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-json v0.17.1 h1:eMfvh/uWggKmY7Pmb3T85u86E2EQg6EQHgyRwf3RkyA= +github.com/hashicorp/terraform-json v0.17.1/go.mod h1:Huy6zt6euxaY9knPAFKjUITn8QxUFIe9VuSzb4zn/0o= github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/huandu/xstrings v1.3.2 h1:L18LIDzqlW6xN2rEkpdV8+oL/IXWJ1APd+vsdYy4Wdw= github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= @@ -74,8 +74,8 @@ github.com/yuin/goldmark v1.5.4 h1:2uY/xC0roWy8IBEGLgB1ywIoEJFGmRrX21YQcvGZzjU= github.com/yuin/goldmark v1.5.4/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yuin/goldmark-meta v1.1.0 h1:pWw+JLHGZe8Rk0EGsMVssiNb/AaPMHfSRszZeUeiOUc= github.com/yuin/goldmark-meta v1.1.0/go.mod h1:U4spWENafuA7Zyg+Lj5RqK/MF+ovMYtBvXi1lBb2VP0= -github.com/zclconf/go-cty v1.13.0 h1:It5dfKTTZHe9aeppbNOda3mN7Ag7sg6QkBNm6TkyFa0= -github.com/zclconf/go-cty v1.13.0/go.mod h1:YKQzy/7pZ7iq2jNFzy5go57xdxdWoLLpaEp4u238AE0= +github.com/zclconf/go-cty v1.13.2 h1:4GvrUxe/QUDYuJKAav4EYqdM47/kZa672LwmXFmEKT0= +github.com/zclconf/go-cty v1.13.2/go.mod h1:YKQzy/7pZ7iq2jNFzy5go57xdxdWoLLpaEp4u238AE0= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20200414173820-0848c9571904/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a h1:vclmkQCjlDX5OydZ9wv8rBCcS0QyQY66Mpf/7BZbInM= diff --git a/main.go b/main.go index 3244609..a92f7c9 100644 --- a/main.go +++ b/main.go @@ -4,8 +4,8 @@ import ( "fmt" "os" - "github.com/bflad/tfproviderdocs/command" - "github.com/bflad/tfproviderdocs/version" + "github.com/YakDriver/tfproviderdocs/command" + "github.com/YakDriver/tfproviderdocs/version" "github.com/mattn/go-colorable" "github.com/mitchellh/cli" )