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

     1  package aws
     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 TestAWSElasticBeanstalkApplication_importBasic(t *testing.T) {
    12  	resourceName := "aws_elastic_beanstalk_application.tftest"
    13  	config := fmt.Sprintf("tf-test-name-%d", acctest.RandInt())
    14  
    15  	resource.Test(t, resource.TestCase{
    16  		PreCheck:     func() { testAccPreCheck(t) },
    17  		Providers:    testAccProviders,
    18  		CheckDestroy: testAccCheckBeanstalkAppDestroy,
    19  		Steps: []resource.TestStep{
    20  			{
    21  				Config: testAccBeanstalkAppImportConfig(config),
    22  			},
    23  
    24  			{
    25  				ResourceName:      resourceName,
    26  				ImportState:       true,
    27  				ImportStateVerify: true,
    28  			},
    29  		},
    30  	})
    31  }
    32  
    33  func testAccBeanstalkAppImportConfig(name string) string {
    34  	return fmt.Sprintf(`resource "aws_elastic_beanstalk_application" "tftest" {
    35  	  name = "%s"
    36  	  description = "tf-test-desc"
    37  	}`, name)
    38  }