github.com/mohanarpit/terraform@v0.6.16-0.20160909104007-291f29853544/builtin/providers/google/import_compute_forwarding_rule_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 TestAccComputeForwardingRule_importBasic(t *testing.T) {
    12  	resourceName := "google_compute_forwarding_rule.foobar"
    13  	poolName := fmt.Sprintf("tf-%s", acctest.RandString(10))
    14  	ruleName := fmt.Sprintf("tf-%s", acctest.RandString(10))
    15  
    16  	resource.Test(t, resource.TestCase{
    17  		PreCheck:     func() { testAccPreCheck(t) },
    18  		Providers:    testAccProviders,
    19  		CheckDestroy: testAccCheckComputeForwardingRuleDestroy,
    20  		Steps: []resource.TestStep{
    21  			resource.TestStep{
    22  				Config: testAccComputeForwardingRule_basic(poolName, ruleName),
    23  			},
    24  
    25  			resource.TestStep{
    26  				ResourceName:      resourceName,
    27  				ImportState:       true,
    28  				ImportStateVerify: true,
    29  			},
    30  		},
    31  	})
    32  }