-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathprovider.go
41 lines (35 loc) · 1004 Bytes
/
provider.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 main
import (
"context"
"fmt"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
func init() {
schema.SchemaDescriptionBuilder = func(s *schema.Schema) string {
desc := s.Description
if s.Default != nil {
desc += fmt.Sprintf(" Defaults to `%v`.", s.Default)
}
if s.Deprecated != "" {
desc += " " + s.Deprecated
}
return desc
}
}
// Provider returns the terraform provider schema.
func NewVagrantProvider(version string) func() *schema.Provider {
return func() *schema.Provider {
return &schema.Provider{
ConfigureContextFunc: vagrantConfigure(version),
ResourcesMap: map[string]*schema.Resource{
"vagrant_vm": resourceVagrantVM(),
},
}
}
}
func vagrantConfigure(version string) func(context.Context, *schema.ResourceData) (interface{}, diag.Diagnostics) {
return func(ctx context.Context, d *schema.ResourceData) (interface{}, diag.Diagnostics) {
return VagrantConfig{}, nil
}
}