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

     1  package google
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/hashicorp/terraform/helper/resource"
     7  )
     8  
     9  func TestAccComputeNetwork_importBasic(t *testing.T) {
    10  	resourceName := "google_compute_network.foobar"
    11  
    12  	resource.Test(t, resource.TestCase{
    13  		PreCheck:     func() { testAccPreCheck(t) },
    14  		Providers:    testAccProviders,
    15  		CheckDestroy: testAccCheckComputeNetworkDestroy,
    16  		Steps: []resource.TestStep{
    17  			{
    18  				Config: testAccComputeNetwork_basic,
    19  			}, {
    20  				ResourceName:      resourceName,
    21  				ImportState:       true,
    22  				ImportStateVerify: true,
    23  				//ImportStateVerifyIgnore: []string{"ipv4_range", "name"},
    24  			},
    25  		},
    26  	})
    27  }
    28  
    29  func TestAccComputeNetwork_importAuto_subnet(t *testing.T) {
    30  	resourceName := "google_compute_network.bar"
    31  
    32  	resource.Test(t, resource.TestCase{
    33  		PreCheck:     func() { testAccPreCheck(t) },
    34  		Providers:    testAccProviders,
    35  		CheckDestroy: testAccCheckComputeNetworkDestroy,
    36  		Steps: []resource.TestStep{
    37  			{
    38  				Config: testAccComputeNetwork_auto_subnet,
    39  			}, {
    40  				ResourceName:      resourceName,
    41  				ImportState:       true,
    42  				ImportStateVerify: true,
    43  			},
    44  		},
    45  	})
    46  }
    47  
    48  func TestAccComputeNetwork_importCustom_subnet(t *testing.T) {
    49  	resourceName := "google_compute_network.baz"
    50  
    51  	resource.Test(t, resource.TestCase{
    52  		PreCheck:     func() { testAccPreCheck(t) },
    53  		Providers:    testAccProviders,
    54  		CheckDestroy: testAccCheckComputeNetworkDestroy,
    55  		Steps: []resource.TestStep{
    56  			{
    57  				Config: testAccComputeNetwork_custom_subnet,
    58  			}, {
    59  				ResourceName:      resourceName,
    60  				ImportState:       true,
    61  				ImportStateVerify: true,
    62  			},
    63  		},
    64  	})
    65  }