github.com/richardmarshall/terraform@v0.9.5-0.20170429023105-15704cc6ee35/builtin/providers/azurerm/import_arm_virtual_machine_test.go (about)

     1  package azurerm
     2  
     3  import (
     4  	"fmt"
     5  	"testing"
     6  
     7  	"github.com/hashicorp/terraform/helper/acctest"
     8  	"github.com/hashicorp/terraform/helper/resource"
     9  )
    10  
    11  func TestAccAzureRMVirtualMachine_importBasic(t *testing.T) {
    12  	resourceName := "azurerm_virtual_machine.test"
    13  
    14  	ri := acctest.RandInt()
    15  	config := fmt.Sprintf(testAccAzureRMVirtualMachine_basicLinuxMachine, ri, ri, ri, ri, ri, ri, ri)
    16  
    17  	resource.Test(t, resource.TestCase{
    18  		PreCheck:     func() { testAccPreCheck(t) },
    19  		Providers:    testAccProviders,
    20  		CheckDestroy: testCheckAzureRMVirtualMachineDestroy,
    21  		Steps: []resource.TestStep{
    22  			{
    23  				Config: config,
    24  			},
    25  
    26  			{
    27  				ResourceName:      resourceName,
    28  				ImportState:       true,
    29  				ImportStateVerify: true,
    30  				ImportStateVerifyIgnore: []string{
    31  					"delete_data_disks_on_termination",
    32  					"delete_os_disk_on_termination",
    33  				},
    34  			},
    35  		},
    36  	})
    37  }
    38  
    39  func TestAccAzureRMVirtualMachine_importBasic_managedDisk(t *testing.T) {
    40  	resourceName := "azurerm_virtual_machine.test"
    41  
    42  	ri := acctest.RandInt()
    43  	config := fmt.Sprintf(testAccAzureRMVirtualMachine_basicLinuxMachine_managedDisk_explicit, ri, ri, ri, ri, ri, ri, ri)
    44  
    45  	resource.Test(t, resource.TestCase{
    46  		PreCheck:     func() { testAccPreCheck(t) },
    47  		Providers:    testAccProviders,
    48  		CheckDestroy: testCheckAzureRMVirtualMachineDestroy,
    49  		Steps: []resource.TestStep{
    50  			{
    51  				Config: config,
    52  			},
    53  
    54  			{
    55  				ResourceName:      resourceName,
    56  				ImportState:       true,
    57  				ImportStateVerify: true,
    58  				ImportStateVerifyIgnore: []string{
    59  					"delete_data_disks_on_termination",
    60  					"delete_os_disk_on_termination",
    61  				},
    62  			},
    63  		},
    64  	})
    65  }