github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/builtin/providers/opc/import_instance_test.go (about)

     1  package opc
     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 TestAccOPCInstance_importBasic(t *testing.T) {
    12  	rInt := acctest.RandInt()
    13  
    14  	resourceName := "opc_compute_instance.test"
    15  	instanceName := fmt.Sprintf("acc-test-instance-%d", rInt)
    16  
    17  	resource.Test(t, resource.TestCase{
    18  		PreCheck: func() {
    19  			testAccPreCheck(t)
    20  		},
    21  		Providers:    testAccProviders,
    22  		CheckDestroy: testAccOPCCheckInstanceDestroy,
    23  		Steps: []resource.TestStep{
    24  			{
    25  				Config: testAccInstanceBasic(rInt),
    26  			},
    27  			{
    28  				ResourceName:            resourceName,
    29  				ImportState:             true,
    30  				ImportStateVerify:       true,
    31  				ImportStateIdPrefix:     instanceName + "/",
    32  				ImportStateVerifyIgnore: []string{"instance_attributes"},
    33  			},
    34  		},
    35  	})
    36  }