github.com/recobe182/terraform@v0.8.5-0.20170117231232-49ab22a935b7/builtin/providers/aws/import_aws_sqs_queue_test.go (about) 1 package aws 2 3 import ( 4 "testing" 5 6 "fmt" 7 8 "github.com/hashicorp/terraform/helper/acctest" 9 "github.com/hashicorp/terraform/helper/resource" 10 ) 11 12 func TestAccAWSSQSQueue_importBasic(t *testing.T) { 13 resourceName := "aws_sqs_queue.queue" 14 queueName := fmt.Sprintf("sqs-queue-%s", acctest.RandString(5)) 15 16 resource.Test(t, resource.TestCase{ 17 PreCheck: func() { testAccPreCheck(t) }, 18 Providers: testAccProviders, 19 CheckDestroy: testAccCheckAWSSQSQueueDestroy, 20 Steps: []resource.TestStep{ 21 { 22 Config: testAccAWSSQSConfigWithDefaults(queueName), 23 }, 24 { 25 ResourceName: resourceName, 26 ImportState: true, 27 ImportStateVerify: true, 28 Check: resource.ComposeTestCheckFunc( 29 resource.TestCheckResourceAttr("aws_sqs_queue.queue", "fifo_queue", "false"), 30 ), 31 }, 32 }, 33 }) 34 } 35 36 func TestAccAWSSQSQueue_importFifo(t *testing.T) { 37 resourceName := "aws_sqs_queue.queue" 38 queueName := fmt.Sprintf("sqs-queue-%s", acctest.RandString(5)) 39 40 resource.Test(t, resource.TestCase{ 41 PreCheck: func() { testAccPreCheck(t) }, 42 Providers: testAccProviders, 43 CheckDestroy: testAccCheckAWSSQSQueueDestroy, 44 Steps: []resource.TestStep{ 45 { 46 Config: testAccAWSSQSFifoConfigWithDefaults(queueName), 47 }, 48 { 49 ResourceName: resourceName, 50 ImportState: true, 51 ImportStateVerify: true, 52 Check: resource.ComposeTestCheckFunc( 53 resource.TestCheckResourceAttr("aws_sqs_queue.queue", "fifo_queue", "true"), 54 ), 55 }, 56 }, 57 }) 58 }