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

     1  package aws
     2  
     3  import (
     4  	"os"
     5  	"testing"
     6  
     7  	"github.com/hashicorp/terraform/helper/acctest"
     8  	"github.com/hashicorp/terraform/helper/resource"
     9  )
    10  
    11  func TestAccAWSElasticacheCluster_importBasic(t *testing.T) {
    12  	oldvar := os.Getenv("AWS_DEFAULT_REGION")
    13  	os.Setenv("AWS_DEFAULT_REGION", "us-east-1")
    14  	defer os.Setenv("AWS_DEFAULT_REGION", oldvar)
    15  
    16  	name := acctest.RandString(10)
    17  
    18  	resourceName := "aws_elasticache_cluster.bar"
    19  
    20  	resource.Test(t, resource.TestCase{
    21  		PreCheck:     func() { testAccPreCheck(t) },
    22  		Providers:    testAccProviders,
    23  		CheckDestroy: testAccCheckAWSElasticacheClusterDestroy,
    24  		Steps: []resource.TestStep{
    25  			resource.TestStep{
    26  				Config: testAccAWSElasticacheClusterConfigBasic(name),
    27  			},
    28  
    29  			resource.TestStep{
    30  				ResourceName:      resourceName,
    31  				ImportState:       true,
    32  				ImportStateVerify: true,
    33  			},
    34  		},
    35  	})
    36  }