Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OS field for vmwarevsphereConfig and machineConfigV2Vmwarevsphere #1343

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/resources/machine_config_v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ The following attributes are exported:
* `hostsystem` - (Optional) vSphere compute resource where the docker VM will be instantiated. This can be omitted if using a cluster with DRS (string)
* `memory_size` - (Optional) vSphere size of memory for docker VM (in MB). Default `2048` (string)
* `network` - (Optional) vSphere network where the docker VM will be attached (list)
* `os` - (Optional) Operating System of the vSphere virtual machines . Default `linux`(string)
* `pool` - (Optional) vSphere resource pool for docker VM (string)
* `ssh_password` - (Optional) If using a non-B2D image you can specify the ssh password. Default `tcuser` (string)
* `ssh_port` - (Optional) If using a non-B2D image you can specify the ssh port. Default `22` (string)
Expand Down
1 change: 1 addition & 0 deletions docs/resources/node_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ The following attributes are exported:
* `hostsystem` - (Optional) vSphere compute resource where the docker VM will be instantiated. This can be omitted if using a cluster with DRS (string)
* `memory_size` - (Optional) vSphere size of memory for docker VM (in MB). Default `2048` (string)
* `network` - (Optional) vSphere network where the docker VM will be attached (list)
* `os` - (Optional) Operating System of the vSphere virtual machines. Default `linux` (string)
* `password` - (Optional/Sensitive) vSphere password. Mandatory on Rancher v2.0.x and v2.1.x. Use `rancher2_cloud_credential` from Rancher v2.2.x (string)
* `pool` - (Optional) vSphere resource pool for docker VM (string)
* `ssh_password` - (Optional) If using a non-B2D image you can specify the ssh password. Default `tcuser`. From Rancher v2.3.3 (string)
Expand Down
6 changes: 6 additions & 0 deletions rancher2/schema_machine_config_v2_vsphere.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ func machineConfigV2VmwarevsphereFields() map[string]*schema.Schema {
Type: schema.TypeString,
},
},
"os": {
Type: schema.TypeString,
Optional: true,
Default: "linux",
Description: "Operating System of the vSphere virtual machines",
},
"password": {
Type: schema.TypeString,
Optional: true,
Expand Down
7 changes: 7 additions & 0 deletions rancher2/schema_node_template_vsphere.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type vmwarevsphereConfig struct {
Hostsystem string `json:"hostsystem,omitempty" yaml:"hostsystem,omitempty"`
MemorySize string `json:"memorySize,omitempty" yaml:"memorySize,omitempty"`
Network []string `json:"network,omitempty" yaml:"network,omitempty"`
OS string `json:"os,omitempty" yaml:"os,omitempty"`
Password string `json:"password,omitempty" yaml:"password,omitempty"`
Pool string `json:"pool,omitempty" yaml:"pool,omitempty"`
SSHPassword string `json:"sshPassword,omitempty" yaml:"sshPassword,omitempty"`
Expand Down Expand Up @@ -158,6 +159,12 @@ func vsphereConfigFields() map[string]*schema.Schema {
Type: schema.TypeString,
},
},
"os": {
Type: schema.TypeString,
Optional: true,
Default: "linux",
Description: "Operating System of the vSphere virtual machines",
},
"password": {
Type: schema.TypeString,
Optional: true,
Expand Down
7 changes: 7 additions & 0 deletions rancher2/structure_machine_config_v2_vsphere.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type machineConfigV2Vmwarevsphere struct {
Hostsystem string `json:"hostsystem,omitempty" yaml:"hostsystem,omitempty"`
MemorySize string `json:"memorySize,omitempty" yaml:"memorySize,omitempty"`
Network []string `json:"network,omitempty" yaml:"network,omitempty"`
OS string `json:"os,omitempty" yaml:"os,omitempty"`
Password string `json:"password,omitempty" yaml:"password,omitempty"`
Pool string `json:"pool,omitempty" yaml:"pool,omitempty"`
SSHPassword string `json:"sshPassword,omitempty" yaml:"sshPassword,omitempty"`
Expand Down Expand Up @@ -116,6 +117,9 @@ func flattenMachineConfigV2Vmwarevsphere(in *MachineConfigV2Vmwarevsphere) []int
if len(in.Network) > 0 {
obj["network"] = toArrayInterface(in.Network)
}
if len(in.OS) > 0 {
obj["os"] = in.OS
}
if len(in.Password) > 0 {
obj["password"] = in.Password
}
Expand Down Expand Up @@ -234,6 +238,9 @@ func expandMachineConfigV2Vmwarevsphere(p []interface{}, source *MachineConfigV2
if v, ok := in["network"].([]interface{}); ok && len(v) > 0 {
obj.Network = toArrayString(v)
}
if v, ok := in["os"].(string); ok && len(v) > 0 {
obj.OS = v
}
if v, ok := in["password"].(string); ok && len(v) > 0 {
obj.Password = v
}
Expand Down
6 changes: 6 additions & 0 deletions rancher2/structure_node_template_vsphere.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ func flattenVsphereConfig(in *vmwarevsphereConfig) []interface{} {
if len(in.Network) > 0 {
obj["network"] = toArrayInterface(in.Network)
}
if len(in.OS) > 0 {
obj["os"] = in.OS
}
if len(in.Password) > 0 {
obj["password"] = in.Password
}
Expand Down Expand Up @@ -168,6 +171,9 @@ func expandVsphereConfig(p []interface{}) *vmwarevsphereConfig {
if v, ok := in["network"].([]interface{}); ok && len(v) > 0 {
obj.Network = toArrayString(v)
}
if v, ok := in["os"].(string); ok && len(v) > 0 {
obj.OS = v
}
if v, ok := in["password"].(string); ok && len(v) > 0 {
obj.Password = v
}
Expand Down