Skip to content

Commit

Permalink
Vsphere: Added uuid attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
eloycoto committed Jun 29, 2016
1 parent 32e0cbf commit 71ae1f9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions builtin/providers/vsphere/resource_vsphere_virtual_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,11 @@ func resourceVSphereVirtualMachine() *schema.Resource {
Default: false,
},

"uuid": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},

"custom_configuration_parameters": &schema.Schema{
Type: schema.TypeMap,
Optional: true,
Expand Down Expand Up @@ -1071,6 +1076,7 @@ func resourceVSphereVirtualMachineRead(d *schema.ResourceData, meta interface{})
d.Set("memory_reservation", mvm.Summary.Config.MemoryReservation)
d.Set("cpu", mvm.Summary.Config.NumCpu)
d.Set("datastore", rootDatastore)
d.Set("uuid", mvm.Summary.Config.Uuid)

return nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"log"
"os"
"regexp"
"testing"

"path/filepath"
Expand Down Expand Up @@ -237,6 +238,7 @@ func (test TestFuncData) testCheckFuncBasic() (
return testAccCheckVSphereVirtualMachineExists(vmName, &test.vm),
resource.TestCheckResourceAttr(vmName, "name", res),
resource.TestCheckResourceAttr(vmName, "vcpu", cpu),
resource.TestMatchResourceAttr(vmName, "uuid", regexp.MustCompile("[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}")),
resource.TestCheckResourceAttr(vmName, "memory", mem),
resource.TestCheckResourceAttr(vmName, "disk.#", disks),
resource.TestCheckResourceAttr(vmName, "network_interface.#", "1"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ The `cdrom` block supports:
The following attributes are exported:

* `id` - The instance ID.
* `uuid` - The instance UUID.
* `name` - See Argument Reference above.
* `vcpu` - See Argument Reference above.
* `memory` - See Argument Reference above.
Expand Down

0 comments on commit 71ae1f9

Please sign in to comment.