github.com/mohanarpit/terraform@v0.6.16-0.20160909104007-291f29853544/builtin/providers/google/import_compute_instance_template_test.go (about)

     1  package google
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/hashicorp/terraform/helper/acctest"
     7  	"github.com/hashicorp/terraform/helper/resource"
     8  )
     9  
    10  func TestAccComputeInstanceTemplate_importBasic(t *testing.T) {
    11  	resourceName := "google_compute_instance_template.foobar"
    12  
    13  	resource.Test(t, resource.TestCase{
    14  		PreCheck:     func() { testAccPreCheck(t) },
    15  		Providers:    testAccProviders,
    16  		CheckDestroy: testAccCheckComputeInstanceTemplateDestroy,
    17  		Steps: []resource.TestStep{
    18  			resource.TestStep{
    19  				Config: testAccComputeInstanceTemplate_basic,
    20  			},
    21  
    22  			resource.TestStep{
    23  				ResourceName:      resourceName,
    24  				ImportState:       true,
    25  				ImportStateVerify: true,
    26  			},
    27  		},
    28  	})
    29  }
    30  
    31  func TestAccComputeInstanceTemplate_importIp(t *testing.T) {
    32  	resourceName := "google_compute_instance_template.foobar"
    33  
    34  	resource.Test(t, resource.TestCase{
    35  		PreCheck:     func() { testAccPreCheck(t) },
    36  		Providers:    testAccProviders,
    37  		CheckDestroy: testAccCheckComputeInstanceTemplateDestroy,
    38  		Steps: []resource.TestStep{
    39  			resource.TestStep{
    40  				Config: testAccComputeInstanceTemplate_ip,
    41  			},
    42  
    43  			resource.TestStep{
    44  				ResourceName:      resourceName,
    45  				ImportState:       true,
    46  				ImportStateVerify: true,
    47  			},
    48  		},
    49  	})
    50  }
    51  
    52  func TestAccComputeInstanceTemplate_importDisks(t *testing.T) {
    53  	resourceName := "google_compute_instance_template.foobar"
    54  
    55  	resource.Test(t, resource.TestCase{
    56  		PreCheck:     func() { testAccPreCheck(t) },
    57  		Providers:    testAccProviders,
    58  		CheckDestroy: testAccCheckComputeInstanceTemplateDestroy,
    59  		Steps: []resource.TestStep{
    60  			resource.TestStep{
    61  				Config: testAccComputeInstanceTemplate_disks,
    62  			},
    63  
    64  			resource.TestStep{
    65  				ResourceName:      resourceName,
    66  				ImportState:       true,
    67  				ImportStateVerify: true,
    68  			},
    69  		},
    70  	})
    71  }
    72  
    73  func TestAccComputeInstanceTemplate_importSubnetAuto(t *testing.T) {
    74  	resourceName := "google_compute_instance_template.foobar"
    75  	network := "network-" + acctest.RandString(10)
    76  
    77  	resource.Test(t, resource.TestCase{
    78  		PreCheck:     func() { testAccPreCheck(t) },
    79  		Providers:    testAccProviders,
    80  		CheckDestroy: testAccCheckComputeInstanceTemplateDestroy,
    81  		Steps: []resource.TestStep{
    82  			resource.TestStep{
    83  				Config: testAccComputeInstanceTemplate_subnet_auto(network),
    84  			},
    85  
    86  			resource.TestStep{
    87  				ResourceName:      resourceName,
    88  				ImportState:       true,
    89  				ImportStateVerify: true,
    90  			},
    91  		},
    92  	})
    93  }
    94  
    95  func TestAccComputeInstanceTemplate_importSubnetCustom(t *testing.T) {
    96  	resourceName := "google_compute_instance_template.foobar"
    97  
    98  	resource.Test(t, resource.TestCase{
    99  		PreCheck:     func() { testAccPreCheck(t) },
   100  		Providers:    testAccProviders,
   101  		CheckDestroy: testAccCheckComputeInstanceTemplateDestroy,
   102  		Steps: []resource.TestStep{
   103  			resource.TestStep{
   104  				Config: testAccComputeInstanceTemplate_subnet_custom,
   105  			},
   106  
   107  			resource.TestStep{
   108  				ResourceName:      resourceName,
   109  				ImportState:       true,
   110  				ImportStateVerify: true,
   111  			},
   112  		},
   113  	})
   114  }