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

     1  package google
     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 TestAccComputeFirewall_importBasic(t *testing.T) {
    12  	resourceName := "google_compute_firewall.foobar"
    13  	networkName := fmt.Sprintf("firewall-test-%s", acctest.RandString(10))
    14  	firewallName := fmt.Sprintf("firewall-test-%s", acctest.RandString(10))
    15  
    16  	resource.Test(t, resource.TestCase{
    17  		PreCheck:     func() { testAccPreCheck(t) },
    18  		Providers:    testAccProviders,
    19  		CheckDestroy: testAccCheckComputeFirewallDestroy,
    20  		Steps: []resource.TestStep{
    21  			resource.TestStep{
    22  				Config: testAccComputeFirewall_basic(networkName, firewallName),
    23  			},
    24  
    25  			resource.TestStep{
    26  				ResourceName:      resourceName,
    27  				ImportState:       true,
    28  				ImportStateVerify: true,
    29  			},
    30  		},
    31  	})
    32  }