-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathprovisioner.go
41 lines (36 loc) · 1.18 KB
/
provisioner.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
package provider
import (
"context"
"runtime"
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
func provisionerDataSource() *schema.Resource {
return &schema.Resource{
SchemaVersion: 1,
Description: "Use this data source to get information about the Coder provisioner.",
ReadContext: func(c context.Context, rd *schema.ResourceData, i interface{}) diag.Diagnostics {
rd.SetId(uuid.NewString())
rd.Set("os", runtime.GOOS)
rd.Set("arch", runtime.GOARCH)
// Fix for #11782: if we're on 32-bit ARM, set arch to armv7.
if runtime.GOARCH == "arm" {
rd.Set("arch", "armv7")
}
return nil
},
Schema: map[string]*schema.Schema{
"os": {
Type: schema.TypeString,
Computed: true,
Description: "The operating system of the host. This exposes `runtime.GOOS` (see [Go constants](https://pkg.go.dev/runtime#pkg-constants)).",
},
"arch": {
Type: schema.TypeString,
Computed: true,
Description: "The architecture of the host. This exposes `runtime.GOARCH` (see [Go constants](https://pkg.go.dev/runtime#pkg-constants)).",
},
},
}
}