Skip to content

Commit 1823252

Browse files
pwelchabhilash-av
authored andcommitted
Add subcategories to docs for Terraform Registry
* Add subcategories to docs for Terraform Registry We will soon be displaying documentation for this provider both on [terraform.io](https://www.terraform.io/docs/providers/index.html) and on [the Terraform Registry](https://registry.terraform.io/providers). Documentation displayed on the Terraform Registry will not use the ERB layout containing the existing navigation, and will instead build the navigation dynamically based on the directory and YAML frontmatter of a file. For providers that group similar resources and data sources by service or use case (subcategories), we'll need to add this information to the Markdown source file. This PR modifies Resource and Data Source documentation source files by adding a subcategory to the metadata if those files were grouped previously. For more information about how documentation is rendered on the Terraform Registry, please see this reference: [Terraform Registry - Provider Documentation](https://www.terraform.io/docs/registry/providers/docs.html). * Add Docs Check Script Add script to check docs compatibility with Terraform Registry importing. * Manually Add Subcategory for Core Shape Management The docscheck script discovered that the oci_core_shape_management documentation was missing subcategory data. Manually adding the meta data to the document. * Update doscheck script for data sources * Add test-docscheck make target to verify.bash
1 parent ab05337 commit 1823252

File tree

420 files changed

+464
-3
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

420 files changed

+464
-3
lines changed

GNUmakefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ ifeq (,$(wildcard $(GOPATH)/src/$(WEBSITE_REPO)))
9090
endif
9191
@$(MAKE) -C $(GOPATH)/src/$(WEBSITE_REPO) website-provider-test PROVIDER_PATH=$(shell pwd) PROVIDER_NAME=$(PKG_NAME)
9292

93+
test-docscheck:
94+
@sh -c "'$(CURDIR)/scripts/docscheck.sh'"
95+
9396
## Additional OCI stuff that will need to be moved eventually
9497
get: ;go get golang.org/x/tools/cmd/goimports; go get github.com/mitchellh/gox
9598

@@ -129,4 +132,4 @@ zip:
129132
tar -czvf openbsd_amd64.tar.gz openbsd_amd64; \
130133
tar -czvf solaris_amd64.tar.gz solaris_amd64
131134

132-
.PHONY: build test testacc vet fmt fmtcheck errcheck test-compile website website-test
135+
.PHONY: build test testacc vet fmt fmtcheck errcheck test-compile website website-test test-docscheck

scripts/docscheck.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env bash
2+
3+
docs=$(ls website/docs/**/*.markdown)
4+
error=false
5+
6+
for doc in $docs; do
7+
dirname=$(dirname "$doc")
8+
category=$(basename "$dirname")
9+
10+
11+
case "$category" in
12+
"guides")
13+
# Guides require a page_title
14+
if ! grep "^page_title: " "$doc" > /dev/null; then
15+
echo "Guide is missing a page_title: $doc"
16+
error=true
17+
fi
18+
;;
19+
20+
"d" | "r")
21+
# Resources and data sources require a subcategory
22+
if ! grep "^subcategory: " "$doc" > /dev/null; then
23+
echo "Doc is missing a subcategory: $doc"
24+
error=true
25+
fi
26+
;;
27+
28+
*)
29+
error=true
30+
echo "Unknown category \"$category\". " \
31+
"Docs can only exist in r/, d/, or guides/ folders."
32+
;;
33+
esac
34+
done
35+
36+
if $error; then
37+
exit 1
38+
fi
39+
40+
exit 0

scripts/verify.bash

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ check_make_target 3 'errcheck'
3535
check_make_target 5 'test-compile' 'TEST=./oci'
3636
check_make_target 6 'ocicheck'
3737
check_make_target 7 'website-test'
38+
check_make_target 8 'test-docscheck'
3839

3940

4041
echo "checking: make build ..."

website/docs/d/audit_configuration.html.markdown

Lines changed: 1 addition & 0 deletions

website/docs/d/audit_events.html.markdown

Lines changed: 1 addition & 0 deletions

website/docs/d/autoscaling_auto_scaling_configuration.html.markdown

Lines changed: 1 addition & 0 deletions

website/docs/d/autoscaling_auto_scaling_configurations.html.markdown

Lines changed: 1 addition & 0 deletions

website/docs/d/budget_alert_rule.html.markdown

Lines changed: 1 addition & 0 deletions

website/docs/d/budget_alert_rules.html.markdown

Lines changed: 1 addition & 0 deletions

website/docs/d/budget_budget.html.markdown

Lines changed: 1 addition & 0 deletions

0 commit comments

Comments
 (0)