-
Notifications
You must be signed in to change notification settings - Fork 1
/
doc_resource.go
761 lines (706 loc) · 23.3 KB
/
doc_resource.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
package readme
import (
"context"
"fmt"
"reflect"
"strings"
"github.com/hashicorp/terraform-plugin-framework/path"
"github.com/hashicorp/terraform-plugin-framework/resource"
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/booldefault"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
"github.com/hashicorp/terraform-plugin-framework/types"
"github.com/hashicorp/terraform-plugin-log/tflog"
"github.com/liveoaklabs/readme-api-go-client/readme"
)
// Ensure the implementation satisfies the expected interfaces.
var (
_ resource.Resource = &docResource{}
_ resource.ResourceWithConfigure = &docResource{}
_ resource.ResourceWithImportState = &docResource{}
)
// docResource is the data source implementation.
type docResource struct {
client *readme.Client
}
// NewDocResource is a helper function to simplify the provider implementation.
func NewDocResource() resource.Resource {
return &docResource{}
}
// Metadata returns the data source type name.
func (r *docResource) Metadata(
_ context.Context,
req resource.MetadataRequest,
resp *resource.MetadataResponse,
) {
resp.TypeName = req.ProviderTypeName + "_doc"
}
// Configure adds the provider configured client to the resource.
func (r *docResource) Configure(
_ context.Context,
req resource.ConfigureRequest,
_ *resource.ConfigureResponse,
) {
if req.ProviderData == nil {
return
}
r.client = req.ProviderData.(*readme.Client)
}
// ValidateConfig is used for validating attribute values.
func (r docResource) ValidateConfig(
ctx context.Context,
req resource.ValidateConfigRequest,
resp *resource.ValidateConfigResponse,
) {
var data docModel
resp.Diagnostics.Append(req.Config.Get(ctx, &data)...)
// category or category_slug must be set. If the attributes aren't set, check the body front matter.
if data.Category.IsNull() && data.CategorySlug.IsNull() {
// check front matter for 'category'.
categoryMatter, diag := valueFromFrontMatter(ctx, data.Body.ValueString(), "Category")
if diag != "" {
resp.Diagnostics.AddAttributeError(
path.Root("category"),
"Error checking front matter during validation.",
diag,
)
return
}
// check front matter for 'category_slug'.
categorySlugMatter, diag := valueFromFrontMatter(
ctx,
data.Body.ValueString(),
"CategorySlug",
)
if diag != "" {
resp.Diagnostics.AddAttributeError(
path.Root("category_slug"),
"Error checking front matter during validation.",
diag,
)
return
}
// Fail if neither category or categorySlug are set in front matter or with attributes.
if categoryMatter == (reflect.Value{}) && categorySlugMatter == (reflect.Value{}) {
resp.Diagnostics.AddAttributeError(
path.Root("category"),
"Missing required attribute.",
"category or category_slug must be set. These can be set using the attribute or in the body front matter.",
)
return
}
}
}
// docPlanToParams maps plan attributes to a `readme.DocParams` struct to create or update a doc.
func docPlanToParams(ctx context.Context, plan docModel) readme.DocParams {
params := readme.DocParams{
Body: strings.TrimSpace(plan.Body.ValueString()),
Hidden: plan.Hidden.ValueBoolPointer(),
Order: intPoint(int(plan.Order.ValueInt64())),
Title: plan.Title.ValueString(),
Type: plan.Type.ValueString(),
}
// Only use one of Category or CategorySlug.
if plan.Category.ValueString() != "" {
params.Category = plan.Category.ValueString()
} else {
params.CategorySlug = plan.CategorySlug.ValueString()
}
// Only use one of ParentDoc or ParentDocSlug.
if plan.ParentDoc.ValueString() != "" {
params.ParentDoc = plan.ParentDoc.ValueString()
} else {
params.ParentDocSlug = plan.ParentDocSlug.ValueString()
}
return params
}
// Create creates the doc and sets the initial Terraform state.
func (r *docResource) Create(
ctx context.Context,
req resource.CreateRequest,
resp *resource.CreateResponse,
) {
// Retrieve values from plan.
var state, plan docModel
diags := req.Plan.Get(ctx, &plan)
resp.Diagnostics.Append(diags...)
if resp.Diagnostics.HasError() {
return
}
requestOpts := apiRequestOptions(plan.Version)
tflog.Info(ctx, fmt.Sprintf("creating doc with request options=%+v", requestOpts))
// If a parent doc is set, verify that it exists.
if plan.VerifyParentDoc.IsNull() || plan.VerifyParentDoc.ValueBool() {
validParent, detail := r.docValidParent(ctx, plan, requestOpts)
if !validParent {
resp.Diagnostics.AddError("Unable to create doc.", detail)
return
}
}
// Create the doc.
response, apiResponse, err := r.client.Doc.Create(docPlanToParams(ctx, plan), requestOpts)
if err != nil {
resp.Diagnostics.AddError("Unable to create doc.", clientError(err, apiResponse))
return
}
// Get the doc.
state, _, err = getDoc(r.client, ctx, response.Slug, plan, requestOpts)
if err != nil {
resp.Diagnostics.AddError(
"Unable to create doc.",
fmt.Sprintf(
"There was a problem retrieving the doc '%s' after creation: %s.",
response.Slug,
err.Error(),
),
)
return
}
// Set state to fully populated data.
diags = resp.State.Set(ctx, state)
resp.Diagnostics.Append(diags...)
if resp.Diagnostics.HasError() {
resp.Diagnostics.AddError("Unable to refresh doc after creation.",
"There was a problem setting the state.")
return
}
}
// Read refreshes the Terraform state with the latest data.
func (r *docResource) Read(
ctx context.Context,
req resource.ReadRequest,
resp *resource.ReadResponse,
) {
// Get current state.
var state docModel
diags := req.State.Get(ctx, &state)
resp.Diagnostics.Append(diags...)
if resp.Diagnostics.HasError() {
return
}
requestOpts := apiRequestOptions(state.Version)
logMsg := fmt.Sprintf("retrieving doc %s with request options=%+v", state.Slug.ValueString(), requestOpts)
tflog.Info(ctx, logMsg)
slug := state.Slug.ValueString()
id := state.ID.ValueString()
// Get the doc.
state, apiResponse, err := getDoc(r.client, ctx, slug, state, requestOpts)
if err != nil {
if apiResponse != nil && apiResponse.HTTPResponse.StatusCode == 404 {
// Attempt to find the doc by ID by searching all docs.
// While the slug is the primary identifier to request a doc, the
// slug is not stable and can be changed through the web UI.
tflog.Info(ctx, fmt.Sprintf("doc %s not found when looking up by slug, performing search", slug))
state, apiResponse, err = getDoc(r.client, ctx, "id:"+id, state, requestOpts)
if err != nil {
if strings.Contains(err.Error(), "no doc found matching id") {
tflog.Info(ctx, fmt.Sprintf("doc %s not found when searching by slug or ID %s, removing from state", slug, id))
resp.State.RemoveResource(ctx)
return
}
resp.Diagnostics.AddError("Unable to search for doc.", clientError(err, apiResponse))
return
}
} else {
resp.Diagnostics.AddError("Unable to retrieve doc.", clientError(err, apiResponse))
return
}
}
// Set refreshed state.
diags = resp.State.Set(ctx, &state)
resp.Diagnostics.Append(diags...)
if resp.Diagnostics.HasError() {
resp.Diagnostics.AddError(
"Unable to refresh doc.",
"There was a problem setting the state.",
)
return
}
}
// Update updates the Doc and sets the updated Terraform state on success.
func (r *docResource) Update(
ctx context.Context,
req resource.UpdateRequest,
resp *resource.UpdateResponse,
) {
// Retrieve values from plan and current state.
var plan, state docModel
resp.Diagnostics.Append(req.State.Get(ctx, &state)...)
resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...)
if resp.Diagnostics.HasError() {
return
}
requestOpts := apiRequestOptions(plan.Version)
tflog.Info(ctx, fmt.Sprintf("updating doc with request options=%+v", requestOpts))
// If a parent doc is set, verify that it exists.
if plan.VerifyParentDoc.IsNull() || plan.VerifyParentDoc.ValueBool() {
validParent, detail := r.docValidParent(ctx, plan, requestOpts)
if !validParent {
resp.Diagnostics.AddError("Unable to update doc.", detail)
return
}
}
// Update the doc.
params := docPlanToParams(ctx, plan)
response, apiResponse, err := r.client.Doc.Update(state.Slug.ValueString(), params, requestOpts)
if err != nil {
resp.Diagnostics.AddError("Unable to update doc.", clientError(err, apiResponse))
return
}
// Get the doc.
plan, _, err = getDoc(r.client, ctx, response.Slug, plan, requestOpts)
if err != nil {
resp.Diagnostics.AddError(
"Unable to update doc.",
fmt.Sprintf(
"There was a problem retrieving the doc '%s' after update: %s.",
response.Slug,
err.Error(),
),
)
return
}
// Set refreshed state.
resp.Diagnostics.Append(resp.State.Set(ctx, plan)...)
if resp.Diagnostics.HasError() {
return
}
}
// Delete deletes the Doc and removes the Terraform state on success.
func (r *docResource) Delete(
ctx context.Context,
req resource.DeleteRequest,
resp *resource.DeleteResponse,
) {
// Retrieve values from state.
var state docModel
resp.Diagnostics.Append(req.State.Get(ctx, &state)...)
if resp.Diagnostics.HasError() {
return
}
requestOpts := apiRequestOptions(state.Version)
tflog.Info(ctx, fmt.Sprintf("deleting doc with request options=%+v", requestOpts))
// Delete the doc.
_, apiResponse, err := r.client.Doc.Delete(state.Slug.ValueString(), requestOpts)
if err != nil {
resp.Diagnostics.AddError("Unable to delete doc", clientError(err, apiResponse))
}
}
// ImportState imports a doc by its slug.
func (r *docResource) ImportState(
ctx context.Context,
req resource.ImportStateRequest,
resp *resource.ImportStateResponse,
) {
// Import by slug.
resource.ImportStatePassthroughID(ctx, path.Root("slug"), req, resp)
}
// docValidParent verifies that a parent doc exists if the `parent_doc` or `parent_doc_slug` attributes are set.
//
// If neither attribute is set, this skips any evaluation and returns true with an empty string.
//
// If the attributes are set, attempt to retrieve the doc. If an error is returned when retrieving the doc,
// return false and the error as a string for use with the plugin framework's "diag" errors.
//
// If the attributes are set and the doc does not exist, return false and a string stating that it doesn't exist
// for use in the response diag error.
func (r *docResource) docValidParent(
ctx context.Context,
plan docModel,
options readme.RequestOptions,
) (bool, string) {
if plan.ParentDoc.ValueString() != "" {
attrVal := "id:" + plan.ParentDoc.ValueString()
_, _, err := r.client.Doc.Get(attrVal, options)
if err != nil {
return false,
fmt.Sprintf(`Could not find parent_doc matching "%s" (is it hidden?)`+
"\n"+`For best results, use the "parent_doc_slug" attribute or set `+
`"verify_parent_doc" to false.`, attrVal,
)
}
} else if plan.ParentDocSlug.ValueString() != "" {
attrVal := plan.ParentDocSlug.ValueString()
_, _, err := r.client.Doc.Get(attrVal, options)
if err != nil {
return false, fmt.Sprintf("Could not find parent_doc_slug matching %s", attrVal)
}
}
return true, ""
}
// Schema for the readme_doc resource.
func (r *docResource) Schema(
_ context.Context,
_ resource.SchemaRequest,
resp *resource.SchemaResponse,
) {
resp.Schema = schema.Schema{
Description: "Manage docs on ReadMe.com\n\n" +
"See <https://docs.readme.com/main/reference/getdoc> for more information about this API endpoint.\n\n" +
"All of the optional attributes except `body` may alternatively be set in the body's front matter. " +
"Attributes take precedence over values set in front matter.\n\n" +
"Refer to <https://docs.readme.com/main/docs/rdme> for more information about using front matter in " +
"ReadMe docs.",
Attributes: map[string]schema.Attribute{
"algolia": schema.SingleNestedAttribute{
Description: "Metadata about the Algolia search integration. " +
"See <https://docs.readme.com/main/docs/search> for more information.",
Computed: true,
Attributes: map[string]schema.Attribute{
"record_count": schema.Int64Attribute{
Computed: true,
},
"publish_pending": schema.BoolAttribute{
Computed: true,
},
"updated_at": schema.StringAttribute{
Computed: true,
},
},
},
"api": schema.SingleNestedAttribute{
Description: "Metadata for an API doc.",
Computed: true,
Attributes: map[string]schema.Attribute{
"api_setting": schema.StringAttribute{
Computed: true,
},
"auth": schema.StringAttribute{
Computed: true,
},
"examples": schema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]schema.Attribute{
"codes": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"code": schema.StringAttribute{
Computed: true,
},
"language": schema.StringAttribute{
Computed: true,
},
},
},
},
},
},
"method": schema.StringAttribute{
Computed: true,
},
"params": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"default": schema.StringAttribute{
Computed: true,
},
"desc": schema.StringAttribute{
Computed: true,
},
"enum_values": schema.StringAttribute{
Computed: true,
},
"id": schema.StringAttribute{
Computed: true,
},
"in": schema.StringAttribute{
Computed: true,
},
"name": schema.StringAttribute{
Computed: true,
},
"ref": schema.StringAttribute{
Computed: true,
},
"required": schema.BoolAttribute{
Computed: true,
},
"type": schema.StringAttribute{
Computed: true,
},
},
},
},
"results": schema.SingleNestedAttribute{
Description: "",
Computed: true,
Attributes: map[string]schema.Attribute{
"codes": schema.ListNestedAttribute{
Computed: true,
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"code": schema.StringAttribute{
Computed: true,
},
"language": schema.StringAttribute{
Computed: true,
},
"name": schema.StringAttribute{
Computed: true,
},
"status": schema.Int64Attribute{
Computed: true,
},
},
},
},
},
},
"url": schema.StringAttribute{
Computed: true,
},
},
},
"body": schema.StringAttribute{
Description: "The body content of the doc, formatted in ReadMe or GitHub flavored Markdown. " +
"Accepts long page content, for example, greater than 100k characters.",
Computed: true,
Optional: true,
},
"body_clean": schema.StringAttribute{
Description: "The body content of the doc after transformations such as trimming leading and trailing" +
"spaces.",
Computed: true,
},
"body_html": schema.StringAttribute{
Description: "The body content in HTML.",
Computed: true,
},
"category": schema.StringAttribute{
Description: "**Required**. The category ID of the doc. Note that changing the category will result " +
"in a replacement of the doc resource. This attribute may optionally be set in the body front " +
"matter or with the `category_slug` attribute.\n\n" +
"Docs that specify a `parent_doc` or `parent_doc_slug` will use their parent's category.",
Computed: true,
Optional: true,
Validators: []validator.String{},
PlanModifiers: []planmodifier.String{
fromMatterString("Category"),
},
},
"category_slug": schema.StringAttribute{
Description: "**Required**. The category ID of the doc. Note that changing the category will result " +
"in a replacement of the doc resource. This attribute may optionally be set in the body front " +
"matter with the `categorySlug` key or with the `category` attribute.\n\n" +
"Docs that specify a `parent_doc` or `parent_doc_slug` will use their parent's category.",
Computed: true,
Optional: true,
PlanModifiers: []planmodifier.String{
fromMatterString("CategorySlug"),
},
},
"created_at": schema.StringAttribute{
Description: "Timestamp of when the version was created.",
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
},
"deprecated": schema.BoolAttribute{
Description: "Toggles if a doc is deprecated or not.",
Computed: true,
},
"error": schema.SingleNestedAttribute{
Description: "Error code configuration for a doc. This attribute may be set in the body front matter.",
Optional: true,
Attributes: map[string]schema.Attribute{
"code": schema.StringAttribute{
Description: "",
Optional: true,
},
},
},
"excerpt": schema.StringAttribute{
Description: "A short summary of the content.",
Computed: true,
},
"hidden": schema.BoolAttribute{
Description: "Toggles if a doc is hidden or not. This attribute may be set in the body front matter.",
Computed: true,
Optional: true,
PlanModifiers: []planmodifier.Bool{
fromMatterBool("Hidden"),
},
},
"icon": schema.StringAttribute{
Computed: true,
},
"id": schema.StringAttribute{
Description: "The ID of the doc.",
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
},
"is_api": schema.BoolAttribute{
Computed: true,
},
"is_reference": schema.BoolAttribute{
Computed: true,
},
"link_external": schema.BoolAttribute{
Computed: true,
},
"link_url": schema.StringAttribute{
Computed: true,
},
"metadata": schema.SingleNestedAttribute{
Computed: true,
Attributes: map[string]schema.Attribute{
"description": schema.StringAttribute{
Computed: true,
},
"image": schema.ListAttribute{
Description: "",
Computed: true,
ElementType: types.StringType,
},
"title": schema.StringAttribute{
Computed: true,
},
},
},
"next": schema.SingleNestedAttribute{
Description: "Information about the 'next' pages in a series.",
Computed: true,
Attributes: map[string]schema.Attribute{
"description": schema.StringAttribute{
Computed: true,
},
"pages": schema.ListNestedAttribute{
Computed: true,
Description: "List of 'next' page configurations.",
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"name": schema.StringAttribute{
Computed: true,
},
"type": schema.StringAttribute{
Computed: true,
},
"icon": schema.StringAttribute{
Computed: true,
},
"slug": schema.StringAttribute{
Computed: true,
},
"category": schema.StringAttribute{
Computed: true,
},
"deprecated": schema.BoolAttribute{
Computed: true,
},
},
},
},
},
},
"order": schema.Int64Attribute{
Description: "The position of the doc in the project sidebar. " +
"This attribute may be set in the body front matter.",
Computed: true,
Optional: true,
PlanModifiers: []planmodifier.Int64{
fromMatterInt64("Order"),
},
},
"parent_doc": schema.StringAttribute{
Description: "For a subpage, specify the parent doc ID." +
"This attribute may be set in the body front matter with the `parentDoc` key." +
"The provider cannot verify that a `parent_doc` exists if it is hidden. To " +
"use a `parent_doc` ID without verifying, set the `verify_parent_doc` " +
"attribute to `false`.",
Computed: true,
Optional: true,
PlanModifiers: []planmodifier.String{
fromMatterString("ParentDoc"),
},
},
"parent_doc_slug": schema.StringAttribute{
Description: "For a subpage, specify the parent doc slug instead of the ID." +
"This attribute may be set in the body front matter with the `parentDocSlug` key." +
"If a value isn't specified but `parent_doc` is, the provider will attempt to populate this " +
"value using the `parent_doc` ID unless `verify_parent_doc` is set to `false`.",
Computed: true,
Optional: true,
PlanModifiers: []planmodifier.String{
fromMatterString("ParentDocSlug"),
},
},
"previous_slug": schema.StringAttribute{
Computed: true,
},
"project": schema.StringAttribute{
Description: "The ID of the project the doc is in.",
Computed: true,
},
"revision": schema.Int64Attribute{
Description: "A number that is incremented upon doc updates.",
Computed: true,
},
"slug": schema.StringAttribute{
Description: "The slug of the doc.",
Computed: true,
},
"slug_updated_at": schema.StringAttribute{
Description: "The timestamp of when the doc's slug was last updated.",
Computed: true,
},
"sync_unique": schema.StringAttribute{
Computed: true,
},
"title": schema.StringAttribute{
Description: "**Required.** The title of the doc." +
"This attribute may optionally be set in the body front matter.",
Computed: true,
Optional: true,
PlanModifiers: []planmodifier.String{
fromMatterString("Title"),
},
},
"type": schema.StringAttribute{
Description: `**Required.** Type of the doc. The available types all show up under the /docs/ URL ` +
`path of your docs project (also known as the "guides" section). Can be "basic" (most common), ` +
`"error" (page desribing an API error), or "link" (page that redirects to an external link).` +
"This attribute may optionally be set in the body front matter.",
Computed: true,
Optional: true,
PlanModifiers: []planmodifier.String{
fromMatterString("Type"),
},
},
"updated_at": schema.StringAttribute{
Description: "The timestamp of when the doc was last updated.",
Computed: true,
},
"user": schema.StringAttribute{
Description: "The ID of the author of the doc in the web editor.",
Computed: true,
},
"version": schema.StringAttribute{
Description: "The version to create the doc under.",
Optional: true,
Computed: true,
},
"version_id": schema.StringAttribute{
Description: "The version ID the doc is associated with.",
Computed: true,
},
"verify_parent_doc": schema.BoolAttribute{
Description: "Enables or disables the provider verifying the `parent_doc` exists. When using the " +
"`parent_doc` attribute with a hidden parent, the provider is unable to verify if the parent " +
"exists. Setting this to `false` will disable this behavior. When `false`, the `parent_doc_slug` " +
"value will not be resolved by the provider unless explicitly set. The `parent_doc_slug` " +
"attribute may be used as an alternative. Verifying a `parent_doc` by ID does not work if the " +
"parent is hidden.",
Optional: true,
Computed: true,
Default: booldefault.StaticBool(true),
},
},
}
}