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

Fixed issue of the storage container attr #147

Merged
merged 4 commits into from
Jun 26, 2020
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/terraform-providers/terraform-provider-nutanix
require (
github.com/client9/misspell v0.3.4
github.com/golangci/golangci-lint v1.25.0
github.com/hashicorp/terraform v0.12.24
github.com/hashicorp/terraform v0.12.28
github.com/mitchellh/gox v1.0.1
github.com/spf13/afero v1.2.2 // indirect
github.com/spf13/cast v1.3.1
Expand Down
42 changes: 33 additions & 9 deletions go.sum

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions nutanix/resource_nutanix_virtual_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,7 @@ func resourceNutanixVirtualMachine() *schema.Resource {
"storage_config": {
Type: schema.TypeList,
Optional: true,
Computed: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
Expand Down Expand Up @@ -697,6 +698,7 @@ func resourceNutanixVirtualMachine() *schema.Resource {
"uuid": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},
},
},
Expand Down
22 changes: 15 additions & 7 deletions nutanix/resource_nutanix_virtual_machine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,16 +364,25 @@ func TestAccNutanixVirtualMachine_cloningVM(t *testing.T) {

func TestAccNutanixVirtualMachine_withDiskContainer(t *testing.T) {
r := acctest.RandInt()

resourceName := "nutanix_virtual_machine.vm-disk"
containerUIID := "de7413d7-2a86-4f9e-8e5a-bea4ce51b4e9"
diskSize := 90 * 1024 * 1024
diskSizeUpdated := 90 * 1024 * 1024 * 1024

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckNutanixVirtualMachineDestroy,
Steps: []resource.TestStep{
{
Config: testAccNutanixVMConfigWithDiskContainer(r),
Config: testAccNutanixVMConfigWithDiskContainer(r, diskSize, containerUIID),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrSet(resourceName, "disk_list.#"),
resource.TestCheckResourceAttr(resourceName, "disk_list.#", "1"),
),
},
{
Config: testAccNutanixVMConfigWithDiskContainer(r, diskSizeUpdated, containerUIID),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrSet(resourceName, "disk_list.#"),
resource.TestCheckResourceAttr(resourceName, "disk_list.#", "1"),
Expand Down Expand Up @@ -986,7 +995,7 @@ func testAccNutanixVMConfigHotAdd(vmName string, cpus, sockets, memory int, hotA
`, vmName, cpus, sockets, memory, hotAdd, imageName)
}

func testAccNutanixVMConfigWithDiskContainer(r int) string {
func testAccNutanixVMConfigWithDiskContainer(r, diskSizeBytes int, continainerUUID string) string {
return fmt.Sprintf(`
data "nutanix_clusters" "clusters" {}

Expand All @@ -1005,18 +1014,17 @@ func testAccNutanixVMConfigWithDiskContainer(r int) string {
memory_size_mib = 186

disk_list {
disk_size_bytes = 68157440
disk_size_mib = 65
disk_size_bytes = %[2]d

storage_config {
storage_container_reference {
kind = "storage_container"
uuid = "2bbe77bc-fd14-4697-8de1-6369757f9219"
uuid = "%[3]s"
}
}
}
}
`, r)
`, r, diskSizeBytes, continainerUUID)
}

func testAccNutanixVMConfigResizeDiskClone(imgName, vmName string, diskSize int) string {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading