github.com/minamijoyo/terraform@v0.7.8-0.20161029001309-18b3736ba44b/builtin/providers/aws/import_aws_cloudfront_distribution_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 TestAccAWSCloudFrontDistribution_importBasic(t *testing.T) {
    12  	ri := acctest.RandInt()
    13  	testConfig := fmt.Sprintf(testAccAWSCloudFrontDistributionS3Config, ri, originBucket, logBucket, testAccAWSCloudFrontDistributionRetainConfig())
    14  
    15  	resourceName := "aws_cloudfront_distribution.s3_distribution"
    16  
    17  	resource.Test(t, resource.TestCase{
    18  		PreCheck:     func() { testAccPreCheck(t) },
    19  		Providers:    testAccProviders,
    20  		CheckDestroy: testAccCheckCloudFrontDistributionDestroy,
    21  		Steps: []resource.TestStep{
    22  			resource.TestStep{
    23  				Config: testConfig,
    24  			},
    25  			resource.TestStep{
    26  				ResourceName:      resourceName,
    27  				ImportState:       true,
    28  				ImportStateVerify: true,
    29  				// Ignore retain_on_delete since it doesn't come from the AWS
    30  				// API.
    31  				ImportStateVerifyIgnore: []string{"retain_on_delete"},
    32  			},
    33  		},
    34  	})
    35  }