Skip to content

Commit cc1f64f

Browse files
committed
Add --blocks-section flag to generate command
Render blocks in separate section if this flag is defined.
1 parent b163c33 commit cc1f64f

24 files changed

+1043
-197
lines changed

Diff for: cmd/tfplugindocs/testdata/scripts/provider-build/generate/framework_provider_success_generic_templates.txtar

+3-3
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ RenderedProviderName: terraform-provider-scaffolding
4949
SchemaMarkdown: <!-- schema generated by tfplugindocs -->
5050
## Schema
5151

52-
### Optional Attributes
52+
### Optional
5353

5454
- `configurable_attribute` (String) Example configurable attribute
5555

@@ -102,7 +102,7 @@ RenderedProviderName: terraform-provider-scaffolding
102102
SchemaMarkdown: <!-- schema generated by tfplugindocs -->
103103
## Schema
104104

105-
### Optional Attributes
105+
### Optional
106106

107107
- `endpoint` (String) Example provider attribute
108108

@@ -149,7 +149,7 @@ RenderedProviderName: terraform-provider-scaffolding
149149
SchemaMarkdown: <!-- schema generated by tfplugindocs -->
150150
## Schema
151151

152-
### Optional Attributes
152+
### Optional
153153

154154
- `configurable_attribute` (String) Example configurable attribute
155155
- `defaulted` (String) Example configurable attribute with default value

Diff for: cmd/tfplugindocs/testdata/scripts/provider-build/generate/framework_provider_success_named_templates.txtar

+3-3
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ RenderedProviderName: terraform-provider-scaffolding
4949
SchemaMarkdown: <!-- schema generated by tfplugindocs -->
5050
## Schema
5151

52-
### Optional Attributes
52+
### Optional
5353

5454
- `configurable_attribute` (String) Example configurable attribute
5555

@@ -102,7 +102,7 @@ RenderedProviderName: terraform-provider-scaffolding
102102
SchemaMarkdown: <!-- schema generated by tfplugindocs -->
103103
## Schema
104104

105-
### Optional Attributes
105+
### Optional
106106

107107
- `endpoint` (String) Example provider attribute
108108

@@ -149,7 +149,7 @@ RenderedProviderName: terraform-provider-scaffolding
149149
SchemaMarkdown: <!-- schema generated by tfplugindocs -->
150150
## Schema
151151

152-
### Optional Attributes
152+
### Optional
153153

154154
- `configurable_attribute` (String) Example configurable attribute
155155
- `defaulted` (String) Example configurable attribute with default value

Diff for: cmd/tfplugindocs/testdata/scripts/provider-build/generate/framework_provider_success_no_templates.txtar

+3-3
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ data "scaffolding_example" "example" {
5656
<!-- schema generated by tfplugindocs -->
5757
## Schema
5858

59-
### Optional Attributes
59+
### Optional
6060

6161
- `configurable_attribute` (String) Example configurable attribute
6262

@@ -87,7 +87,7 @@ provider "scaffolding" {
8787
<!-- schema generated by tfplugindocs -->
8888
## Schema
8989

90-
### Optional Attributes
90+
### Optional
9191

9292
- `endpoint` (String) Example provider attribute
9393
-- expected-resource.md --
@@ -114,7 +114,7 @@ resource "scaffolding_example" "example" {
114114
<!-- schema generated by tfplugindocs -->
115115
## Schema
116116

117-
### Optional Attributes
117+
### Optional
118118

119119
- `configurable_attribute` (String) Example configurable attribute
120120
- `defaulted` (String) Example configurable attribute with default value

Diff for: cmd/tfplugindocs/testdata/scripts/provider-build/generate/null_provider_success.txtar

+6-6
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ class MyConvertedCode(TerraformStack):
228228
<!-- schema generated by tfplugindocs -->
229229
## Schema
230230

231-
### Optional Attributes
231+
### Optional
232232

233233
- `has_computed_default` (String) If set, its literal value will be stored and returned. If not, its value defaults to `"default"`. This argument exists primarily for testing and has little practical use.
234234
- `inputs` (Map of String) A map of arbitrary strings that is copied into the `outputs` attribute, and accessible directly for interpolation.
@@ -339,7 +339,7 @@ class MyConvertedCode(TerraformStack):
339339
<!-- schema generated by tfplugindocs -->
340340
## Schema
341341

342-
### Optional Attributes
342+
### Optional
343343

344344
- `triggers` (Map of String) A map of arbitrary strings that, when changed, will force the null resource to be replaced, re-running any associated provisioners.
345345

@@ -456,7 +456,7 @@ class MyConvertedCode extends TerraformStack {
456456
<!-- schema generated by tfplugindocs -->
457457
## Schema
458458

459-
### Optional Attributes
459+
### Optional
460460

461461
- `hasComputedDefault` (String) If set, its literal value will be stored and returned. If not, its value defaults to `"default"`. This argument exists primarily for testing and has little practical use.
462462
- `inputs` (Map of String) A map of arbitrary strings that is copied into the `outputs` attribute, and accessible directly for interpolation.
@@ -577,7 +577,7 @@ class MyConvertedCode extends TerraformStack {
577577
<!-- schema generated by tfplugindocs -->
578578
## Schema
579579

580-
### Optional Attributes
580+
### Optional
581581

582582
- `triggers` (Map of String) A map of arbitrary strings that, when changed, will force the null resource to be replaced, re-running any associated provisioners.
583583

@@ -663,7 +663,7 @@ output "all_server_ips" {
663663
<!-- schema generated by tfplugindocs -->
664664
## Schema
665665

666-
### Optional Attributes
666+
### Optional
667667

668668
- `has_computed_default` (String) If set, its literal value will be stored and returned. If not, its value defaults to `"default"`. This argument exists primarily for testing and has little practical use.
669669
- `inputs` (Map of String) A map of arbitrary strings that is copied into the `outputs` attribute, and accessible directly for interpolation.
@@ -758,7 +758,7 @@ resource "null_resource" "cluster" {
758758
<!-- schema generated by tfplugindocs -->
759759
## Schema
760760

761-
### Optional Attributes
761+
### Optional
762762

763763
- `triggers` (Map of String) A map of arbitrary strings that, when changed, will force the null resource to be replaced, re-running any associated provisioners.
764764

Diff for: cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_all_framework_types.txtar

+39-45
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Example provider
4545
<!-- schema generated by tfplugindocs -->
4646
## Schema
4747

48-
### Optional Attributes
48+
### Optional
4949

5050
- `endpoint` (String) Example provider attribute
5151
-- expected-resource.md --
@@ -66,12 +66,14 @@ example resource
6666
<!-- schema generated by tfplugindocs -->
6767
## Schema
6868

69-
### Optional Attributes
69+
### Optional
7070

7171
- `bool_attribute` (Boolean) example bool attribute
7272
- `float64_attribute` (Number) example float64 attribute
7373
- `int64_attribute` (Number) example int64 attribute
7474
- `list_attribute` (List of String) example list attribute
75+
- `list_nested_block` (Block List) example list nested block (see [below for nested schema](#nestedblock--list_nested_block))
76+
- `list_nested_block_sensitive_nested_attribute` (Block List) (see [below for nested schema](#nestedblock--list_nested_block_sensitive_nested_attribute))
7577
- `map_attribute` (Map of String) example map attribute
7678
- `number_attribute` (Number) example number attribute
7779
- `object_attribute` (Object) example object attribute (see [below for nested schema](#nestedatt--object_attribute))
@@ -86,104 +88,96 @@ example resource
8688
- `sensitive_set_attribute` (Set of String, Sensitive) example sensitive set attribute
8789
- `sensitive_string_attribute` (String, Sensitive) example sensitive string attribute
8890
- `set_attribute` (Set of String) example set attribute
89-
- `string_attribute` (String) example string attribute
90-
91-
### Blocks
92-
93-
- `list_nested_block` (Block List) example list nested block (see [below for nested schema](#nestedblock--list_nested_block))
94-
- `list_nested_block_sensitive_nested_attribute` (Block List) (see [below for nested schema](#nestedblock--list_nested_block_sensitive_nested_attribute))
9591
- `set_nested_block` (Block Set) example set nested block (see [below for nested schema](#nestedblock--set_nested_block))
9692
- `single_nested_block` (Block, Optional) example single nested block (see [below for nested schema](#nestedblock--single_nested_block))
9793
- `single_nested_block_sensitive_nested_attribute` (Block, Optional) example sensitive single nested block (see [below for nested schema](#nestedblock--single_nested_block_sensitive_nested_attribute))
94+
- `string_attribute` (String) example string attribute
9895

9996
### Read-Only
10097

10198
- `id` (String) The ID of this resource.
10299
- `set_nested_block_sensitive_nested_attribute` (Block Set) example sensitive set nested block (see [below for nested schema](#nestedblock--set_nested_block_sensitive_nested_attribute))
103100

104-
<a id="nestedatt--object_attribute"></a>
105-
### Nested Schema for `object_attribute`
101+
<a id="nestedblock--list_nested_block"></a>
102+
### Nested Schema for `list_nested_block`
106103

107-
Optional Attributes:
104+
Optional:
108105

109-
- `object_attribute_attribute` (String)
106+
- `list_nested_block_attribute` (String) example list nested block attribute
107+
- `list_nested_block_attribute_with_default` (String) example list nested block attribute with default
108+
- `nested_list_block` (Block List) (see [below for nested schema](#nestedblock--list_nested_block--nested_list_block))
110109

110+
<a id="nestedblock--list_nested_block--nested_list_block"></a>
111+
### Nested Schema for `list_nested_block.nested_list_block`
111112

112-
<a id="nestedatt--object_attribute_with_nested_object_attribute"></a>
113-
### Nested Schema for `object_attribute_with_nested_object_attribute`
113+
Optional:
114114

115-
Optional Attributes:
115+
- `nested_block_string_attribute` (String) example nested block string attribute
116116

117-
- `nested_object` (Object) (see [below for nested schema](#nestedobjatt--object_attribute_with_nested_object_attribute--nested_object))
118-
- `object_attribute_attribute` (String)
119117

120-
<a id="nestedobjatt--object_attribute_with_nested_object_attribute--nested_object"></a>
121-
### Nested Schema for `object_attribute_with_nested_object_attribute.nested_object`
122118

123-
Optional Attributes:
119+
<a id="nestedblock--list_nested_block_sensitive_nested_attribute"></a>
120+
### Nested Schema for `list_nested_block_sensitive_nested_attribute`
124121

125-
- `nested_object_attribute` (String)
122+
Optional:
126123

124+
- `list_nested_block_attribute` (String) example list nested block attribute
125+
- `list_nested_block_sensitive_attribute` (String, Sensitive) example sensitive list nested block attribute
127126

128127

129-
<a id="nestedatt--sensitive_object_attribute"></a>
130-
### Nested Schema for `sensitive_object_attribute`
128+
<a id="nestedatt--object_attribute"></a>
129+
### Nested Schema for `object_attribute`
131130

132-
Optional Attributes:
131+
Optional:
133132

134133
- `object_attribute_attribute` (String)
135134

136135

137-
<a id="nestedblock--list_nested_block"></a>
138-
### Nested Schema for `list_nested_block`
139-
140-
Optional Attributes:
141-
142-
- `list_nested_block_attribute` (String) example list nested block attribute
143-
- `list_nested_block_attribute_with_default` (String) example list nested block attribute with default
136+
<a id="nestedatt--object_attribute_with_nested_object_attribute"></a>
137+
### Nested Schema for `object_attribute_with_nested_object_attribute`
144138

145-
Blocks:
139+
Optional:
146140

147-
- `nested_list_block` (Block List) (see [below for nested schema](#nestedblock--list_nested_block--nested_list_block))
141+
- `nested_object` (Object) (see [below for nested schema](#nestedobjatt--object_attribute_with_nested_object_attribute--nested_object))
142+
- `object_attribute_attribute` (String)
148143

149-
<a id="nestedblock--list_nested_block--nested_list_block"></a>
150-
### Nested Schema for `list_nested_block.nested_list_block`
144+
<a id="nestedobjatt--object_attribute_with_nested_object_attribute--nested_object"></a>
145+
### Nested Schema for `object_attribute_with_nested_object_attribute.nested_object`
151146

152-
Optional Attributes:
147+
Optional:
153148

154-
- `nested_block_string_attribute` (String) example nested block string attribute
149+
- `nested_object_attribute` (String)
155150

156151

157152

158-
<a id="nestedblock--list_nested_block_sensitive_nested_attribute"></a>
159-
### Nested Schema for `list_nested_block_sensitive_nested_attribute`
153+
<a id="nestedatt--sensitive_object_attribute"></a>
154+
### Nested Schema for `sensitive_object_attribute`
160155

161-
Optional Attributes:
156+
Optional:
162157

163-
- `list_nested_block_attribute` (String) example list nested block attribute
164-
- `list_nested_block_sensitive_attribute` (String, Sensitive) example sensitive list nested block attribute
158+
- `object_attribute_attribute` (String)
165159

166160

167161
<a id="nestedblock--set_nested_block"></a>
168162
### Nested Schema for `set_nested_block`
169163

170-
Optional Attributes:
164+
Optional:
171165

172166
- `set_nested_block_attribute` (String) example set nested block attribute
173167

174168

175169
<a id="nestedblock--single_nested_block"></a>
176170
### Nested Schema for `single_nested_block`
177171

178-
Optional Attributes:
172+
Optional:
179173

180174
- `single_nested_block_attribute` (String) example single nested block attribute
181175

182176

183177
<a id="nestedblock--single_nested_block_sensitive_nested_attribute"></a>
184178
### Nested Schema for `single_nested_block_sensitive_nested_attribute`
185179

186-
Optional Attributes:
180+
Optional:
187181

188182
- `single_nested_block_attribute` (String) example single nested block attribute
189183
- `single_nested_block_sensitive_attribute` (String, Sensitive) example sensitive single nested block attribute

0 commit comments

Comments
 (0)