/
schema_machine_config_v2_harvester.go
94 lines (90 loc) · 2.24 KB
/
schema_machine_config_v2_harvester.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
package rancher2
import (
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
)
//Schemas
func machineConfigV2HarvesterFields() map[string]*schema.Schema {
s := map[string]*schema.Schema{
"vm_namespace": {
Type: schema.TypeString,
Required: true,
Description: "Virtual machine namespace",
},
"cpu_count": {
Type: schema.TypeString,
Optional: true,
Default: "2",
Description: "CPU count",
},
"memory_size": {
Type: schema.TypeString,
Optional: true,
Default: "4",
Description: "Memory size (in GiB)",
},
"disk_size": {
Type: schema.TypeString,
Optional: true,
Default: "40",
Description: "Disk size (in GiB)",
},
"disk_bus": {
Type: schema.TypeString,
Optional: true,
Default: harvesterDiskBusVIRTIO,
ValidateFunc: validation.StringInSlice([]string{
harvesterDiskBusVIRTIO,
harvesterDiskBusSATA,
harvesterDiskBusSCSI,
}, false),
Description: "Disk bus",
},
"image_name": {
Type: schema.TypeString,
Required: true,
Description: "Image name",
},
"ssh_user": {
Type: schema.TypeString,
Required: true,
Description: "SSH username",
},
"ssh_password": {
Type: schema.TypeString,
Optional: true,
Sensitive: true,
Description: "SSH password",
},
"network_name": {
Type: schema.TypeString,
Required: true,
Description: "Network name",
},
"network_model": {
Type: schema.TypeString,
Optional: true,
Default: harvesterNetworkModelVIRTIO,
ValidateFunc: validation.StringInSlice([]string{
harvesterNetworkModelVIRTIO,
harvesterNetworkModelE1000,
harvesterNetworkModelE1000E,
harvesterNetworkModelNE2KPCO,
harvesterNetworkModelPCNET,
harvesterNetworkModelRTL8139,
}, false),
Description: "Network model",
},
"user_data": {
Type: schema.TypeString,
Optional: true,
Description: "UserData content of cloud-init, base64 is supported",
},
"network_data": {
Type: schema.TypeString,
Optional: true,
Description: "NetworkData content of cloud-init, base64 is supported",
},
}
return s
}