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

     1  package aws
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/hashicorp/terraform/helper/acctest"
     7  	"github.com/hashicorp/terraform/helper/resource"
     8  )
     9  
    10  func TestAccAWSS3BucketNotification_importBasic(t *testing.T) {
    11  	resourceName := "aws_s3_bucket_notification.notification"
    12  
    13  	resource.Test(t, resource.TestCase{
    14  		PreCheck:     func() { testAccPreCheck(t) },
    15  		Providers:    testAccProviders,
    16  		CheckDestroy: testAccCheckAWSS3BucketNotificationDestroy,
    17  		Steps: []resource.TestStep{
    18  			resource.TestStep{
    19  				Config: testAccAWSS3BucketConfigWithTopicNotification(acctest.RandInt()),
    20  			},
    21  
    22  			resource.TestStep{
    23  				ResourceName:            resourceName,
    24  				ImportState:             true,
    25  				ImportStateVerify:       true,
    26  				ImportStateVerifyIgnore: []string{"bucket"},
    27  			},
    28  		},
    29  	})
    30  
    31  	resource.Test(t, resource.TestCase{
    32  		PreCheck:     func() { testAccPreCheck(t) },
    33  		Providers:    testAccProviders,
    34  		CheckDestroy: testAccCheckAWSS3BucketNotificationDestroy,
    35  		Steps: []resource.TestStep{
    36  			resource.TestStep{
    37  				Config: testAccAWSS3BucketConfigWithQueueNotification(acctest.RandInt()),
    38  			},
    39  
    40  			resource.TestStep{
    41  				ResourceName:            resourceName,
    42  				ImportState:             true,
    43  				ImportStateVerify:       true,
    44  				ImportStateVerifyIgnore: []string{"bucket"},
    45  			},
    46  		},
    47  	})
    48  
    49  	resource.Test(t, resource.TestCase{
    50  		PreCheck:     func() { testAccPreCheck(t) },
    51  		Providers:    testAccProviders,
    52  		CheckDestroy: testAccCheckAWSS3BucketNotificationDestroy,
    53  		Steps: []resource.TestStep{
    54  			resource.TestStep{
    55  				Config: testAccAWSS3BucketConfigWithLambdaNotification(acctest.RandInt()),
    56  			},
    57  
    58  			resource.TestStep{
    59  				ResourceName:            resourceName,
    60  				ImportState:             true,
    61  				ImportStateVerify:       true,
    62  				ImportStateVerifyIgnore: []string{"bucket"},
    63  			},
    64  		},
    65  	})
    66  }