1
+ # Copyright (c) HashiCorp, Inc.
2
+ # SPDX-License-Identifier: MPL-2.0
3
+
4
+ # Successful run of tfplugindocs on a Framework provider with docs in the legacy directory structure (i.e. r/<resource name>.md.tmpl)
5
+ [!unix] skip
6
+ exec tfplugindocs --provider-name=terraform-provider-scaffolding --providers-schema=schema.json
7
+ cmp stdout expected-output.txt
8
+
9
+ # Check that static files copied successfully to rendered docs directory
10
+ cmp templates/r/example.md docs/r/example.md
11
+ cmp templates/r/example.markdown docs/r/example.markdown
12
+ cmp templates/r/example.html.markdown docs/r/example.html.markdown
13
+ cmp templates/r/example.html.md docs/r/example.html.md
14
+
15
+ cmp templates/d/example.md docs/d/example.md
16
+ cmp templates/d/example.markdown docs/d/example.markdown
17
+ cmp templates/d/example.html.markdown docs/d/example.html.markdown
18
+ cmp templates/d/example.html.md docs/d/example.html.md
19
+
20
+ cmp templates/index.md docs/index.md
21
+ cmp templates/index.markdown docs/index.markdown
22
+ cmp templates/index.html.markdown docs/index.html.markdown
23
+ cmp templates/index.html.md docs/index.html.md
24
+ -- expected-output.txt --
25
+ rendering website for provider "terraform-provider-scaffolding" (as "terraform-provider-scaffolding")
26
+ copying any existing content to tmp dir
27
+ exporting schema from JSON file
28
+ getting provider schema
29
+ generating missing templates
30
+ generating missing resource content
31
+ resource "scaffolding_example" static file exists, skipping
32
+ generating missing data source content
33
+ data-source "scaffolding_example" static file exists, skipping
34
+ generating missing provider content
35
+ provider "terraform-provider-scaffolding" static file exists, skipping
36
+ rendering static website
37
+ cleaning rendered website dir
38
+ rendering templated website to static markdown
39
+ copying non-template file: "d/example.html.markdown"
40
+ copying non-template file: "d/example.html.md"
41
+ copying non-template file: "d/example.markdown"
42
+ copying non-template file: "d/example.md"
43
+ copying non-template file: "index.html.markdown"
44
+ copying non-template file: "index.html.md"
45
+ copying non-template file: "index.markdown"
46
+ copying non-template file: "index.md"
47
+ copying non-template file: "r/example.html.markdown"
48
+ copying non-template file: "r/example.html.md"
49
+ copying non-template file: "r/example.markdown"
50
+ copying non-template file: "r/example.md"
51
+ -- templates/r/example.md --
52
+ # Data Fields
53
+
54
+ Name: {{.Name}}
55
+ Type: {{.Type}}
56
+ -- templates/r/example.markdown --
57
+ # Data Fields
58
+
59
+ Name: {{.Name}}
60
+ Type: {{.Type}}
61
+ -- templates/r/example.html.markdown --
62
+ # Data Fields
63
+
64
+ Name: {{.Name}}
65
+ Type: {{.Type}}
66
+ -- templates/r/example.html.md --
67
+ # Data Fields
68
+
69
+ Name: {{.Name}}
70
+ Type: {{.Type}}
71
+ -- templates/d/example.md --
72
+ # Data Fields
73
+
74
+ Name: {{.Name}}
75
+ Type: {{.Type}}
76
+ -- templates/d/example.markdown --
77
+ # Data Fields
78
+
79
+ Name: {{.Name}}
80
+ Type: {{.Type}}
81
+ -- templates/d/example.html.markdown --
82
+ # Data Fields
83
+
84
+ Name: {{.Name}}
85
+ Type: {{.Type}}
86
+ -- templates/d/example.html.md --
87
+ # Data Fields
88
+
89
+ Name: {{.Name}}
90
+ Type: {{.Type}}
91
+ -- templates/index.md --
92
+ # Data Fields
93
+
94
+ Name: {{.Name}}
95
+ Type: {{.Type}}
96
+ -- templates/index.markdown --
97
+ # Data Fields
98
+
99
+ Name: {{.Name}}
100
+ Type: {{.Type}}
101
+ -- templates/index.html.markdown --
102
+ # Data Fields
103
+
104
+ Name: {{.Name}}
105
+ Type: {{.Type}}
106
+ -- templates/index.html.md --
107
+ # Data Fields
108
+
109
+ Name: {{.Name}}
110
+ Type: {{.Type}}
111
+ -- examples/README.md --
112
+ # Examples
113
+
114
+ This directory contains examples that are mostly used for documentation, but can also be run/tested manually via the Terraform CLI.
115
+
116
+ The document generation tool looks for files in the following locations by default. All other *.tf files besides the ones mentioned below are ignored by the documentation tool. This is useful for creating examples that can run and/or ar testable even if some parts are not relevant for the documentation.
117
+
118
+ * **provider/provider.tf** example file for the provider index page
119
+ * **data-sources/`full data source name`/data-source.tf** example file for the named data source page
120
+ * **resources/`full resource name`/resource.tf** example file for the named data source page
121
+ -- examples/data-sources/scaffolding_example/data-source.tf --
122
+ data "scaffolding_example" "example" {
123
+ configurable_attribute = "some-value"
124
+ }
125
+ -- examples/provider/provider.tf --
126
+ provider "scaffolding" {
127
+ # example configuration here
128
+ }
129
+ -- examples/resources/scaffolding_example/resource.tf --
130
+ resource "scaffolding_example" "example" {
131
+ configurable_attribute = "some-value"
132
+ }
133
+ -- examples/resources/scaffolding_example/import.sh --
134
+ terraform import scaffolding_example.example
135
+ -- schema.json --
136
+ {
137
+ "format_version": "1.0",
138
+ "provider_schemas": {
139
+ "registry.terraform.io/hashicorp/scaffolding": {
140
+ "provider": {
141
+ "version": 0,
142
+ "block": {
143
+ "attributes": {
144
+ "endpoint": {
145
+ "type": "string",
146
+ "description": "Example provider attribute",
147
+ "description_kind": "markdown",
148
+ "optional": true
149
+ }
150
+ },
151
+ "description": "Example provider",
152
+ "description_kind": "markdown"
153
+ }
154
+ },
155
+ "resource_schemas": {
156
+ "scaffolding_example": {
157
+ "version": 0,
158
+ "block": {
159
+ "attributes": {
160
+ "configurable_attribute": {
161
+ "type": "string",
162
+ "description": "Example configurable attribute",
163
+ "description_kind": "markdown",
164
+ "optional": true
165
+ },
166
+ "defaulted": {
167
+ "type": "string",
168
+ "description": "Example configurable attribute with default value",
169
+ "description_kind": "markdown",
170
+ "optional": true,
171
+ "computed": true
172
+ },
173
+ "id": {
174
+ "type": "string",
175
+ "description": "Example identifier",
176
+ "description_kind": "markdown",
177
+ "computed": true
178
+ }
179
+ },
180
+ "description": "Example resource",
181
+ "description_kind": "markdown"
182
+ }
183
+ }
184
+ },
185
+ "data_source_schemas": {
186
+ "scaffolding_example": {
187
+ "version": 0,
188
+ "block": {
189
+ "attributes": {
190
+ "configurable_attribute": {
191
+ "type": "string",
192
+ "description": "Example configurable attribute",
193
+ "description_kind": "markdown",
194
+ "optional": true
195
+ },
196
+ "id": {
197
+ "type": "string",
198
+ "description": "Example identifier",
199
+ "description_kind": "markdown",
200
+ "computed": true
201
+ }
202
+ },
203
+ "description": "Example data source",
204
+ "description_kind": "markdown"
205
+ }
206
+ }
207
+ }
208
+ }
209
+ }
210
+ }
0 commit comments