Skip to content

Commit

Permalink
check: Prevent mixed Terraform Provider documentation directory layou…
Browse files Browse the repository at this point in the history
…ts found error when using website/docs and docs/ contains files outside Terraform Provider documentation (#31)

Reference: #30
  • Loading branch information
bflad authored May 7, 2020
1 parent e68b94b commit 0a1ffd7
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# v0.5.1

BUG FIXES

* check: Prevent `mixed Terraform Provider documentation directory layouts found` error when using `website/docs` and `docs/` contains files outside Terraform Provider documentation

# v0.5.0

ENHANCEMENTS
Expand Down
4 changes: 4 additions & 0 deletions check/check_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ func TestCheck(t *testing.T) {
Name: "valid legacy directories",
BasePath: "testdata/valid-legacy-directories",
},
{
Name: "valid mixed directories",
BasePath: "testdata/valid-mixed-directories",
},
{
Name: "invalid directories",
BasePath: "testdata/invalid-directories",
Expand Down
3 changes: 2 additions & 1 deletion check/directory.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ func MixedDirectoriesCheck(directories map[string][]string) error {
err := fmt.Errorf("mixed Terraform Provider documentation directory layouts found, must use only legacy or registry layout")

for directory := range directories {
if IsValidRegistryDirectory(directory) {
// Allow docs/ with other files
if IsValidRegistryDirectory(directory) && directory != RegistryIndexDirectory {
registryDirectoryFound = true

if legacyDirectoryFound {
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
subcategory: "Example"
layout: "example"
page_title: "Example: example_thing"
description: |-
Example description.
---

# Resource: example_thing

Byline.

## Example Usage

```hcl
resource "example_thing" "example" {
name = "example"
}
```

## Argument Reference

* `name` - (Required) Name of thing.

## Attribute Reference

* `id` - Name of thing.
2 changes: 1 addition & 1 deletion version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var (
GitDescribe string

// The main version number that is being run at the moment.
Version = "0.6.0"
Version = "0.5.1"

// A pre-release marker for the version. If this is "" (empty string)
// then it means that it is a final release. Otherwise, this is a pre-release
Expand Down

0 comments on commit 0a1ffd7

Please sign in to comment.