From 8b4e98e732800f2d18f3efd9b2033c359ce3f37f Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 21 Apr 2016 08:44:45 -0700 Subject: [PATCH] providers/aws: some id-only work on s3 buckets more work needed --- builtin/providers/aws/resource_aws_s3_bucket.go | 5 +++++ builtin/providers/aws/resource_aws_s3_bucket_test.go | 11 +++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/builtin/providers/aws/resource_aws_s3_bucket.go b/builtin/providers/aws/resource_aws_s3_bucket.go index 2ec1c32e6..d4e384b64 100644 --- a/builtin/providers/aws/resource_aws_s3_bucket.go +++ b/builtin/providers/aws/resource_aws_s3_bucket.go @@ -417,6 +417,11 @@ func resourceAwsS3BucketRead(d *schema.ResourceData, meta interface{}) error { } } + // In the import case, we won't have this + if _, ok := d.GetOk("bucket"); !ok { + d.Set("bucket", d.Id()) + } + // Read the policy pol, err := s3conn.GetBucketPolicy(&s3.GetBucketPolicyInput{ Bucket: aws.String(d.Id()), diff --git a/builtin/providers/aws/resource_aws_s3_bucket_test.go b/builtin/providers/aws/resource_aws_s3_bucket_test.go index a1cfd0315..c6a893e7e 100644 --- a/builtin/providers/aws/resource_aws_s3_bucket_test.go +++ b/builtin/providers/aws/resource_aws_s3_bucket_test.go @@ -23,10 +23,13 @@ func TestAccAWSS3Bucket_basic(t *testing.T) { "^arn:aws:s3:::") resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - IDRefreshName: "aws_s3_bucket.bucket", - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSS3BucketDestroy, + PreCheck: func() { testAccPreCheck(t) }, + /* + IDRefreshName: "aws_s3_bucket.bucket", + IDRefreshIgnore: []string{"force_destroy"}, + */ + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ resource.TestStep{ Config: testAccAWSS3BucketConfig(rInt),