diff --git a/builtin/providers/aws/import_aws_cloudfront_distribution_test.go b/builtin/providers/aws/import_aws_cloudfront_distribution_test.go index 237a26d4b..9fc195819 100644 --- a/builtin/providers/aws/import_aws_cloudfront_distribution_test.go +++ b/builtin/providers/aws/import_aws_cloudfront_distribution_test.go @@ -1,12 +1,17 @@ package aws import ( + "fmt" "testing" + "github.com/hashicorp/terraform/helper/acctest" "github.com/hashicorp/terraform/helper/resource" ) func TestAccAWSCloudFrontDistribution_importBasic(t *testing.T) { + ri := acctest.RandInt() + testConfig := fmt.Sprintf(testAccAWSCloudFrontDistributionS3Config, ri, originBucket, logBucket, testAccAWSCloudFrontDistributionRetainConfig()) + resourceName := "aws_cloudfront_distribution.s3_distribution" resource.Test(t, resource.TestCase{ @@ -15,7 +20,7 @@ func TestAccAWSCloudFrontDistribution_importBasic(t *testing.T) { CheckDestroy: testAccCheckCloudFrontDistributionDestroy, Steps: []resource.TestStep{ resource.TestStep{ - Config: testAccAWSCloudFrontDistributionS3Config, + Config: testConfig, }, resource.TestStep{ ResourceName: resourceName, diff --git a/builtin/providers/aws/resource_aws_cloudfront_distribution_test.go b/builtin/providers/aws/resource_aws_cloudfront_distribution_test.go index dd395a63a..6f1ec870b 100644 --- a/builtin/providers/aws/resource_aws_cloudfront_distribution_test.go +++ b/builtin/providers/aws/resource_aws_cloudfront_distribution_test.go @@ -20,13 +20,15 @@ import ( // If you are testing manually and can't wait for deletion, set the // TF_TEST_CLOUDFRONT_RETAIN environment variable. func TestAccAWSCloudFrontDistribution_S3Origin(t *testing.T) { + ri := acctest.RandInt() + testConfig := fmt.Sprintf(testAccAWSCloudFrontDistributionS3Config, ri, originBucket, logBucket, testAccAWSCloudFrontDistributionRetainConfig()) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontDistributionDestroy, Steps: []resource.TestStep{ resource.TestStep{ - Config: testAccAWSCloudFrontDistributionS3Config, + Config: testConfig, Check: resource.ComposeTestCheckFunc( testAccCheckCloudFrontDistributionExistence( "aws_cloudfront_distribution.s3_distribution", @@ -265,7 +267,7 @@ resource "aws_s3_bucket" "s3_bucket_logs" { } `) -var testAccAWSCloudFrontDistributionS3Config = fmt.Sprintf(` +var testAccAWSCloudFrontDistributionS3Config = ` variable rand_id { default = %d } @@ -316,7 +318,7 @@ resource "aws_cloudfront_distribution" "s3_distribution" { } %s } -`, rand.New(rand.NewSource(time.Now().UnixNano())).Int(), originBucket, logBucket, testAccAWSCloudFrontDistributionRetainConfig()) +` var testAccAWSCloudFrontDistributionS3ConfigWithTags = ` variable rand_id {