-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathfile.go
49 lines (46 loc) · 1.38 KB
/
file.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
package provider
import (
"context"
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
)
func fileResource() *schema.Resource {
return &schema.Resource{
Description: "Use this resource to place a file inside of a workspace.",
CreateContext: func(ctx context.Context, rd *schema.ResourceData, i interface{}) diag.Diagnostics {
rd.SetId(uuid.NewString())
return nil
},
ReadContext: schema.NoopContext,
DeleteContext: schema.NoopContext,
Schema: map[string]*schema.Schema{
"agent_id": {
Type: schema.TypeString,
Description: `The "id" property of a "coder_agent" resource to associate with.`,
ForceNew: true,
Required: true,
},
"path": {
Type: schema.TypeString,
Description: "The path of the file to place in the workspace.",
ForceNew: true,
Required: true,
},
"content": {
Type: schema.TypeString,
Description: "The content of the file to place in the workspace.",
ForceNew: true,
Required: true,
},
"mode": {
Type: schema.TypeInt,
Description: "The mode of the file to place in the workspace.",
ForceNew: true,
Optional: true,
ValidateFunc: validation.IntBetween(0, 0777),
},
},
}
}