-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathdevcontainer.go
46 lines (41 loc) · 1.32 KB
/
devcontainer.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
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 devcontainerResource() *schema.Resource {
return &schema.Resource{
SchemaVersion: 1,
Description: "Define a Dev Container the agent should know of and attempt to autostart (minimum Coder version: v2.21).",
CreateContext: func(_ context.Context, rd *schema.ResourceData, _ 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,
},
"workspace_folder": {
Type: schema.TypeString,
Description: "The workspace folder to for the Dev Container.",
ForceNew: true,
Required: true,
ValidateFunc: validation.StringIsNotEmpty,
},
"config_path": {
Type: schema.TypeString,
Description: "The path to the Dev Container configuration file (devcontainer.json).",
ForceNew: true,
Optional: true,
},
},
}
}