|
| 1 | +package provider |
| 2 | + |
| 3 | +import ( |
| 4 | + "context" |
| 5 | + |
| 6 | + "github.com/google/uuid" |
| 7 | + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" |
| 8 | + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" |
| 9 | + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" |
| 10 | +) |
| 11 | + |
| 12 | +func fileResource() *schema.Resource { |
| 13 | + return &schema.Resource{ |
| 14 | + Description: "Use this resource to place a file inside of a workspace.", |
| 15 | + CreateContext: func(ctx context.Context, rd *schema.ResourceData, i interface{}) diag.Diagnostics { |
| 16 | + rd.SetId(uuid.NewString()) |
| 17 | + return nil |
| 18 | + }, |
| 19 | + ReadContext: schema.NoopContext, |
| 20 | + DeleteContext: schema.NoopContext, |
| 21 | + Schema: map[string]*schema.Schema{ |
| 22 | + "agent_id": { |
| 23 | + Type: schema.TypeString, |
| 24 | + Description: `The "id" property of a "coder_agent" resource to associate with.`, |
| 25 | + ForceNew: true, |
| 26 | + Required: true, |
| 27 | + }, |
| 28 | + "path": { |
| 29 | + Type: schema.TypeString, |
| 30 | + Description: "The path of the file to place in the workspace.", |
| 31 | + ForceNew: true, |
| 32 | + Required: true, |
| 33 | + }, |
| 34 | + "content": { |
| 35 | + Type: schema.TypeString, |
| 36 | + Description: "The content of the file to place in the workspace.", |
| 37 | + ForceNew: true, |
| 38 | + Required: true, |
| 39 | + }, |
| 40 | + "mode": { |
| 41 | + Type: schema.TypeInt, |
| 42 | + Description: "The mode of the file to place in the workspace.", |
| 43 | + ForceNew: true, |
| 44 | + Optional: true, |
| 45 | + ValidateFunc: validation.IntBetween(0, 0777), |
| 46 | + }, |
| 47 | + }, |
| 48 | + } |
| 49 | +} |
0 commit comments