github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/builtin/providers/aws/import_aws_redshift_security_group_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 TestAccAWSRedshiftSecurityGroup_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  	rInt := acctest.RandInt()
    16  
    17  	resourceName := "aws_redshift_security_group.bar"
    18  
    19  	resource.Test(t, resource.TestCase{
    20  		PreCheck:     func() { testAccPreCheck(t) },
    21  		Providers:    testAccProviders,
    22  		CheckDestroy: testAccCheckAWSRedshiftSecurityGroupDestroy,
    23  		Steps: []resource.TestStep{
    24  			{
    25  				Config: testAccAWSRedshiftSecurityGroupConfig_ingressCidr(rInt),
    26  			},
    27  
    28  			{
    29  				ResourceName:      resourceName,
    30  				ImportState:       true,
    31  				ImportStateVerify: true,
    32  			},
    33  		},
    34  	})
    35  }