From 8c1d32182cb71a171be2b496f576dc715ed1de1b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Mon, 31 Jan 2022 12:09:59 -0500 Subject: [PATCH 01/17] Rename s3_bucket_object to s3_object --- internal/provider/provider.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/provider/provider.go b/internal/provider/provider.go index 7e495efc9c0..871357a9d74 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -685,8 +685,8 @@ func Provider() *schema.Provider { "aws_canonical_user_id": s3.DataSourceCanonicalUserID(), "aws_s3_bucket": s3.DataSourceBucket(), - "aws_s3_bucket_object": s3.DataSourceBucketObject(), - "aws_s3_bucket_objects": s3.DataSourceBucketObjects(), + "aws_s3_object": s3.DataSourceBucketObject(), + "aws_s3_objects": s3.DataSourceBucketObjects(), "aws_sagemaker_prebuilt_ecr_image": sagemaker.DataSourcePrebuiltECRImage(), @@ -1593,7 +1593,7 @@ func Provider() *schema.Provider { "aws_s3_bucket_inventory": s3.ResourceBucketInventory(), "aws_s3_bucket_metric": s3.ResourceBucketMetric(), "aws_s3_bucket_notification": s3.ResourceBucketNotification(), - "aws_s3_bucket_object": s3.ResourceBucketObject(), + "aws_s3_object": s3.ResourceBucketObject(), "aws_s3_bucket_ownership_controls": s3.ResourceBucketOwnershipControls(), "aws_s3_bucket_policy": s3.ResourceBucketPolicy(), "aws_s3_bucket_public_access_block": s3.ResourceBucketPublicAccessBlock(), From 74a90ea824e8c5e04b917f2b0b8b930fd18801c5 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Mon, 31 Jan 2022 12:10:32 -0500 Subject: [PATCH 02/17] Update examples --- examples/s3-cross-account-access/main.tf | 4 ++-- examples/sagemaker/main.tf | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/s3-cross-account-access/main.tf b/examples/s3-cross-account-access/main.tf index 178f9131b00..ddae63032fa 100644 --- a/examples/s3-cross-account-access/main.tf +++ b/examples/s3-cross-account-access/main.tf @@ -34,7 +34,7 @@ resource "aws_s3_bucket" "prod" { POLICY } -resource "aws_s3_bucket_object" "prod" { +resource "aws_s3_object" "prod" { provider = aws.prod bucket = aws_s3_bucket.prod.id @@ -50,7 +50,7 @@ provider "aws" { secret_key = var.test_secret_key } -resource "aws_s3_bucket_object" "test" { +resource "aws_s3_object" "test" { provider = aws.test bucket = aws_s3_bucket.prod.id diff --git a/examples/sagemaker/main.tf b/examples/sagemaker/main.tf index ded75b3b90e..2babe537ee2 100644 --- a/examples/sagemaker/main.tf +++ b/examples/sagemaker/main.tf @@ -86,7 +86,7 @@ resource "aws_s3_bucket" "foo" { force_destroy = true } -resource "aws_s3_bucket_object" "object" { +resource "aws_s3_object" "object" { bucket = aws_s3_bucket.foo.bucket key = "model.tar.gz" source = "model.tar.gz" From 49eaa7e1d0ac760e1cfdfef284062c3526485cd9 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Mon, 31 Jan 2022 12:12:00 -0500 Subject: [PATCH 03/17] Update s3 package --- internal/service/s3/bucket.go | 2 +- .../s3/bucket_object_data_source_test.go | 122 +++++++++--------- internal/service/s3/bucket_object_test.go | 112 ++++++++-------- .../s3/bucket_objects_data_source_test.go | 110 ++++++++-------- internal/service/s3/bucket_test.go | 2 +- internal/service/s3/object_copy_test.go | 14 +- internal/service/s3/sweep.go | 6 +- 7 files changed, 184 insertions(+), 184 deletions(-) diff --git a/internal/service/s3/bucket.go b/internal/service/s3/bucket.go index cda17ff1bbd..1d538674c2d 100644 --- a/internal/service/s3/bucket.go +++ b/internal/service/s3/bucket.go @@ -1426,7 +1426,7 @@ func resourceBucketDelete(d *schema.ResourceData, meta interface{}) error { if tfawserr.ErrMessageContains(err, "BucketNotEmpty", "") { if d.Get("force_destroy").(bool) { // Use a S3 service client that can handle multiple slashes in URIs. - // While aws_s3_bucket_object resources cannot create these object + // While aws_s3_object resources cannot create these object // keys, other AWS services and applications using the S3 Bucket can. conn = meta.(*conns.AWSClient).S3ConnURICleaningDisabled diff --git a/internal/service/s3/bucket_object_data_source_test.go b/internal/service/s3/bucket_object_data_source_test.go index 733e97b054f..85e596a7e19 100644 --- a/internal/service/s3/bucket_object_data_source_test.go +++ b/internal/service/s3/bucket_object_data_source_test.go @@ -23,8 +23,8 @@ func TestAccS3BucketObjectDataSource_basic(t *testing.T) { var rObj s3.GetObjectOutput var dsObj s3.GetObjectOutput - resourceName := "aws_s3_bucket_object.object" - dataSourceName := "data.aws_s3_bucket_object.obj" + resourceName := "aws_s3_object.object" + dataSourceName := "data.aws_s3_object.obj" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(t) }, @@ -55,8 +55,8 @@ func TestAccS3BucketObjectDataSource_basicViaAccessPoint(t *testing.T) { var dsObj, rObj s3.GetObjectOutput rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - dataSourceName := "data.aws_s3_bucket_object.test" - resourceName := "aws_s3_bucket_object.test" + dataSourceName := "data.aws_s3_object.test" + resourceName := "aws_s3_object.test" accessPointResourceName := "aws_s3_access_point.test" resource.ParallelTest(t, resource.TestCase{ @@ -84,8 +84,8 @@ func TestAccS3BucketObjectDataSource_readableBody(t *testing.T) { var rObj s3.GetObjectOutput var dsObj s3.GetObjectOutput - resourceName := "aws_s3_bucket_object.object" - dataSourceName := "data.aws_s3_bucket_object.obj" + resourceName := "aws_s3_object.object" + dataSourceName := "data.aws_s3_object.obj" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(t) }, @@ -118,8 +118,8 @@ func TestAccS3BucketObjectDataSource_kmsEncrypted(t *testing.T) { var rObj s3.GetObjectOutput var dsObj s3.GetObjectOutput - resourceName := "aws_s3_bucket_object.object" - dataSourceName := "data.aws_s3_bucket_object.obj" + resourceName := "aws_s3_object.object" + dataSourceName := "data.aws_s3_object.obj" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(t) }, @@ -154,8 +154,8 @@ func TestAccS3BucketObjectDataSource_bucketKeyEnabled(t *testing.T) { var rObj s3.GetObjectOutput var dsObj s3.GetObjectOutput - resourceName := "aws_s3_bucket_object.object" - dataSourceName := "data.aws_s3_bucket_object.obj" + resourceName := "aws_s3_object.object" + dataSourceName := "data.aws_s3_object.obj" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(t) }, @@ -191,8 +191,8 @@ func TestAccS3BucketObjectDataSource_allParams(t *testing.T) { var rObj s3.GetObjectOutput var dsObj s3.GetObjectOutput - resourceName := "aws_s3_bucket_object.object" - dataSourceName := "data.aws_s3_bucket_object.obj" + resourceName := "aws_s3_object.object" + dataSourceName := "data.aws_s3_object.obj" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(t) }, @@ -222,7 +222,7 @@ func TestAccS3BucketObjectDataSource_allParams(t *testing.T) { // Supported, but difficult to reproduce in short testing time resource.TestCheckResourceAttrPair(dataSourceName, "storage_class", resourceName, "storage_class"), resource.TestCheckResourceAttr(dataSourceName, "expiration", ""), - // Currently unsupported in aws_s3_bucket_object resource + // Currently unsupported in aws_s3_object resource resource.TestCheckResourceAttr(dataSourceName, "expires", ""), resource.TestCheckResourceAttrPair(dataSourceName, "website_redirect_location", resourceName, "website_redirect"), resource.TestCheckResourceAttr(dataSourceName, "metadata.%", "0"), @@ -242,8 +242,8 @@ func TestAccS3BucketObjectDataSource_objectLockLegalHoldOff(t *testing.T) { var rObj s3.GetObjectOutput var dsObj s3.GetObjectOutput - resourceName := "aws_s3_bucket_object.object" - dataSourceName := "data.aws_s3_bucket_object.obj" + resourceName := "aws_s3_object.object" + dataSourceName := "data.aws_s3_object.obj" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(t) }, @@ -277,8 +277,8 @@ func TestAccS3BucketObjectDataSource_objectLockLegalHoldOn(t *testing.T) { var rObj s3.GetObjectOutput var dsObj s3.GetObjectOutput - resourceName := "aws_s3_bucket_object.object" - dataSourceName := "data.aws_s3_bucket_object.obj" + resourceName := "aws_s3_object.object" + dataSourceName := "data.aws_s3_object.obj" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(t) }, @@ -309,10 +309,10 @@ func TestAccS3BucketObjectDataSource_leadingSlash(t *testing.T) { var rObj s3.GetObjectOutput var dsObj1, dsObj2, dsObj3 s3.GetObjectOutput - resourceName := "aws_s3_bucket_object.object" - dataSourceName1 := "data.aws_s3_bucket_object.obj1" - dataSourceName2 := "data.aws_s3_bucket_object.obj2" - dataSourceName3 := "data.aws_s3_bucket_object.obj3" + resourceName := "aws_s3_object.object" + dataSourceName1 := "data.aws_s3_object.obj1" + dataSourceName2 := "data.aws_s3_object.obj2" + dataSourceName3 := "data.aws_s3_object.obj3" rInt := sdkacctest.RandInt() resourceOnlyConf, conf := testAccObjectDataSourceConfig_leadingSlash(rInt) @@ -362,11 +362,11 @@ func TestAccS3BucketObjectDataSource_multipleSlashes(t *testing.T) { var rObj1, rObj2 s3.GetObjectOutput var dsObj1, dsObj2, dsObj3 s3.GetObjectOutput - resourceName1 := "aws_s3_bucket_object.object1" - resourceName2 := "aws_s3_bucket_object.object2" - dataSourceName1 := "data.aws_s3_bucket_object.obj1" - dataSourceName2 := "data.aws_s3_bucket_object.obj2" - dataSourceName3 := "data.aws_s3_bucket_object.obj3" + resourceName1 := "aws_s3_object.object1" + resourceName2 := "aws_s3_object.object2" + dataSourceName1 := "data.aws_s3_object.obj1" + dataSourceName2 := "data.aws_s3_object.obj2" + dataSourceName3 := "data.aws_s3_object.obj3" rInt := sdkacctest.RandInt() resourceOnlyConf, conf := testAccObjectDataSourceConfig_multipleSlashes(rInt) @@ -410,7 +410,7 @@ func TestAccS3BucketObjectDataSource_multipleSlashes(t *testing.T) { func TestAccS3BucketObjectDataSource_singleSlashAsKey(t *testing.T) { var dsObj s3.GetObjectOutput - dataSourceName := "data.aws_s3_bucket_object.test" + dataSourceName := "data.aws_s3_object.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ @@ -463,15 +463,15 @@ resource "aws_s3_bucket" "object_bucket" { bucket = "tf-object-test-bucket-%[1]d" } -resource "aws_s3_bucket_object" "object" { +resource "aws_s3_object" "object" { bucket = aws_s3_bucket.object_bucket.bucket key = "tf-testing-obj-%[1]d" content = "Hello World" } -data "aws_s3_bucket_object" "obj" { +data "aws_s3_object" "obj" { bucket = aws_s3_bucket.object_bucket.bucket - key = aws_s3_bucket_object.object.key + key = aws_s3_object.object.key } `, randInt) } @@ -487,15 +487,15 @@ resource "aws_s3_access_point" "test" { name = %[1]q } -resource "aws_s3_bucket_object" "test" { +resource "aws_s3_object" "test" { bucket = aws_s3_bucket.test.bucket key = %[1]q content = "Hello World" } -data "aws_s3_bucket_object" "test" { +data "aws_s3_object" "test" { bucket = aws_s3_access_point.test.arn - key = aws_s3_bucket_object.test.key + key = aws_s3_object.test.key } `, rName) } @@ -506,16 +506,16 @@ resource "aws_s3_bucket" "object_bucket" { bucket = "tf-object-test-bucket-%[1]d" } -resource "aws_s3_bucket_object" "object" { +resource "aws_s3_object" "object" { bucket = aws_s3_bucket.object_bucket.bucket key = "tf-testing-obj-%[1]d-readable" content = "yes" content_type = "text/plain" } -data "aws_s3_bucket_object" "obj" { +data "aws_s3_object" "obj" { bucket = aws_s3_bucket.object_bucket.bucket - key = aws_s3_bucket_object.object.key + key = aws_s3_object.object.key } `, randInt) } @@ -531,7 +531,7 @@ resource "aws_kms_key" "example" { deletion_window_in_days = 7 } -resource "aws_s3_bucket_object" "object" { +resource "aws_s3_object" "object" { bucket = aws_s3_bucket.object_bucket.bucket key = "tf-testing-obj-%[1]d-encrypted" content = "Keep Calm and Carry On" @@ -539,9 +539,9 @@ resource "aws_s3_bucket_object" "object" { kms_key_id = aws_kms_key.example.arn } -data "aws_s3_bucket_object" "obj" { +data "aws_s3_object" "obj" { bucket = aws_s3_bucket.object_bucket.bucket - key = aws_s3_bucket_object.object.key + key = aws_s3_object.object.key } `, randInt) } @@ -557,7 +557,7 @@ resource "aws_kms_key" "example" { deletion_window_in_days = 7 } -resource "aws_s3_bucket_object" "object" { +resource "aws_s3_object" "object" { bucket = aws_s3_bucket.object_bucket.bucket key = "tf-testing-obj-%[1]d-encrypted" content = "Keep Calm and Carry On" @@ -566,9 +566,9 @@ resource "aws_s3_bucket_object" "object" { bucket_key_enabled = true } -data "aws_s3_bucket_object" "obj" { +data "aws_s3_object" "obj" { bucket = aws_s3_bucket.object_bucket.bucket - key = aws_s3_bucket_object.object.key + key = aws_s3_object.object.key } `, randInt) } @@ -583,7 +583,7 @@ resource "aws_s3_bucket" "object_bucket" { } } -resource "aws_s3_bucket_object" "object" { +resource "aws_s3_object" "object" { bucket = aws_s3_bucket.object_bucket.bucket key = "tf-testing-obj-%[1]d-all-params" @@ -603,9 +603,9 @@ CONTENT } } -data "aws_s3_bucket_object" "obj" { +data "aws_s3_object" "obj" { bucket = aws_s3_bucket.object_bucket.bucket - key = aws_s3_bucket_object.object.key + key = aws_s3_object.object.key } `, randInt) } @@ -624,16 +624,16 @@ resource "aws_s3_bucket" "object_bucket" { } } -resource "aws_s3_bucket_object" "object" { +resource "aws_s3_object" "object" { bucket = aws_s3_bucket.object_bucket.bucket key = "tf-testing-obj-%[1]d" content = "Hello World" object_lock_legal_hold_status = "OFF" } -data "aws_s3_bucket_object" "obj" { +data "aws_s3_object" "obj" { bucket = aws_s3_bucket.object_bucket.bucket - key = aws_s3_bucket_object.object.key + key = aws_s3_object.object.key } `, randInt) } @@ -652,7 +652,7 @@ resource "aws_s3_bucket" "object_bucket" { } } -resource "aws_s3_bucket_object" "object" { +resource "aws_s3_object" "object" { bucket = aws_s3_bucket.object_bucket.bucket key = "tf-testing-obj-%[1]d" content = "Hello World" @@ -662,9 +662,9 @@ resource "aws_s3_bucket_object" "object" { object_lock_retain_until_date = "%[2]s" } -data "aws_s3_bucket_object" "obj" { +data "aws_s3_object" "obj" { bucket = aws_s3_bucket.object_bucket.bucket - key = aws_s3_bucket_object.object.key + key = aws_s3_object.object.key } `, randInt, retainUntilDate) } @@ -675,7 +675,7 @@ resource "aws_s3_bucket" "object_bucket" { bucket = "tf-object-test-bucket-%[1]d" } -resource "aws_s3_bucket_object" "object" { +resource "aws_s3_object" "object" { bucket = aws_s3_bucket.object_bucket.bucket key = "//tf-testing-obj-%[1]d-readable" content = "yes" @@ -686,17 +686,17 @@ resource "aws_s3_bucket_object" "object" { both := fmt.Sprintf(` %[1]s -data "aws_s3_bucket_object" "obj1" { +data "aws_s3_object" "obj1" { bucket = aws_s3_bucket.object_bucket.bucket key = "tf-testing-obj-%[2]d-readable" } -data "aws_s3_bucket_object" "obj2" { +data "aws_s3_object" "obj2" { bucket = aws_s3_bucket.object_bucket.bucket key = "/tf-testing-obj-%[2]d-readable" } -data "aws_s3_bucket_object" "obj3" { +data "aws_s3_object" "obj3" { bucket = aws_s3_bucket.object_bucket.bucket key = "//tf-testing-obj-%[2]d-readable" } @@ -711,7 +711,7 @@ resource "aws_s3_bucket" "object_bucket" { bucket = "tf-object-test-bucket-%[1]d" } -resource "aws_s3_bucket_object" "object1" { +resource "aws_s3_object" "object1" { bucket = aws_s3_bucket.object_bucket.bucket key = "first//second///third//" content = "yes" @@ -719,7 +719,7 @@ resource "aws_s3_bucket_object" "object1" { } # Without a trailing slash. -resource "aws_s3_bucket_object" "object2" { +resource "aws_s3_object" "object2" { bucket = aws_s3_bucket.object_bucket.bucket key = "/first////second/third" content = "no" @@ -730,17 +730,17 @@ resource "aws_s3_bucket_object" "object2" { both := fmt.Sprintf(` %s -data "aws_s3_bucket_object" "obj1" { +data "aws_s3_object" "obj1" { bucket = aws_s3_bucket.object_bucket.bucket key = "first/second/third/" } -data "aws_s3_bucket_object" "obj2" { +data "aws_s3_object" "obj2" { bucket = aws_s3_bucket.object_bucket.bucket key = "first//second///third//" } -data "aws_s3_bucket_object" "obj3" { +data "aws_s3_object" "obj3" { bucket = aws_s3_bucket.object_bucket.bucket key = "first/second/third" } @@ -755,7 +755,7 @@ resource "aws_s3_bucket" "test" { bucket = %[1]q } -data "aws_s3_bucket_object" "test" { +data "aws_s3_object" "test" { bucket = aws_s3_bucket.test.bucket key = "/" } diff --git a/internal/service/s3/bucket_object_test.go b/internal/service/s3/bucket_object_test.go index e46d9314eb0..86ac712fdbe 100644 --- a/internal/service/s3/bucket_object_test.go +++ b/internal/service/s3/bucket_object_test.go @@ -51,7 +51,7 @@ func TestAccS3BucketObject_noNameNoKey(t *testing.T) { func TestAccS3BucketObject_empty(t *testing.T) { var obj s3.GetObjectOutput - resourceName := "aws_s3_bucket_object.object" + resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ @@ -81,7 +81,7 @@ func TestAccS3BucketObject_empty(t *testing.T) { func TestAccS3BucketObject_source(t *testing.T) { var obj s3.GetObjectOutput - resourceName := "aws_s3_bucket_object.object" + resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) source := testAccBucketObjectCreateTempFile(t, "{anything will do }") @@ -113,7 +113,7 @@ func TestAccS3BucketObject_source(t *testing.T) { func TestAccS3BucketObject_content(t *testing.T) { var obj s3.GetObjectOutput - resourceName := "aws_s3_bucket_object.object" + resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ @@ -143,7 +143,7 @@ func TestAccS3BucketObject_content(t *testing.T) { func TestAccS3BucketObject_etagEncryption(t *testing.T) { var obj s3.GetObjectOutput - resourceName := "aws_s3_bucket_object.object" + resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) source := testAccBucketObjectCreateTempFile(t, "{anything will do }") defer os.Remove(source) @@ -176,7 +176,7 @@ func TestAccS3BucketObject_etagEncryption(t *testing.T) { func TestAccS3BucketObject_contentBase64(t *testing.T) { var obj s3.GetObjectOutput - resourceName := "aws_s3_bucket_object.object" + resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ @@ -199,7 +199,7 @@ func TestAccS3BucketObject_contentBase64(t *testing.T) { func TestAccS3BucketObject_sourceHashTrigger(t *testing.T) { var obj, updated_obj s3.GetObjectOutput - resourceName := "aws_s3_bucket_object.object" + resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) startingData := "Ebben!" @@ -255,7 +255,7 @@ func TestAccS3BucketObject_sourceHashTrigger(t *testing.T) { func TestAccS3BucketObject_withContentCharacteristics(t *testing.T) { var obj s3.GetObjectOutput - resourceName := "aws_s3_bucket_object.object" + resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) source := testAccBucketObjectCreateTempFile(t, "{anything will do }") @@ -285,7 +285,7 @@ func TestAccS3BucketObject_nonVersioned(t *testing.T) { defer os.Remove(sourceInitial) rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) var originalObj s3.GetObjectOutput - resourceName := "aws_s3_bucket_object.object" + resourceName := "aws_s3_object.object" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(t); acctest.PreCheckAssumeRoleARN(t) }, @@ -314,7 +314,7 @@ func TestAccS3BucketObject_nonVersioned(t *testing.T) { func TestAccS3BucketObject_updates(t *testing.T) { var originalObj, modifiedObj s3.GetObjectOutput - resourceName := "aws_s3_bucket_object.object" + resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) sourceInitial := testAccBucketObjectCreateTempFile(t, "initial object state") @@ -363,7 +363,7 @@ func TestAccS3BucketObject_updates(t *testing.T) { func TestAccS3BucketObject_updateSameFile(t *testing.T) { var originalObj, modifiedObj s3.GetObjectOutput - resourceName := "aws_s3_bucket_object.object" + resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) startingData := "lane 8" @@ -410,7 +410,7 @@ func TestAccS3BucketObject_updateSameFile(t *testing.T) { func TestAccS3BucketObject_updatesWithVersioning(t *testing.T) { var originalObj, modifiedObj s3.GetObjectOutput - resourceName := "aws_s3_bucket_object.object" + resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) sourceInitial := testAccBucketObjectCreateTempFile(t, "initial versioned object state") @@ -455,7 +455,7 @@ func TestAccS3BucketObject_updatesWithVersioning(t *testing.T) { func TestAccS3BucketObject_updatesWithVersioningViaAccessPoint(t *testing.T) { var originalObj, modifiedObj s3.GetObjectOutput rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - resourceName := "aws_s3_bucket_object.test" + resourceName := "aws_s3_object.test" accessPointResourceName := "aws_s3_access_point.test" sourceInitial := testAccBucketObjectCreateTempFile(t, "initial versioned object state") @@ -493,7 +493,7 @@ func TestAccS3BucketObject_updatesWithVersioningViaAccessPoint(t *testing.T) { func TestAccS3BucketObject_kms(t *testing.T) { var obj s3.GetObjectOutput - resourceName := "aws_s3_bucket_object.object" + resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) source := testAccBucketObjectCreateTempFile(t, "{anything will do }") @@ -527,7 +527,7 @@ func TestAccS3BucketObject_kms(t *testing.T) { func TestAccS3BucketObject_sse(t *testing.T) { var obj s3.GetObjectOutput - resourceName := "aws_s3_bucket_object.object" + resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) source := testAccBucketObjectCreateTempFile(t, "{anything will do }") @@ -561,7 +561,7 @@ func TestAccS3BucketObject_sse(t *testing.T) { func TestAccS3BucketObject_acl(t *testing.T) { var obj1, obj2, obj3 s3.GetObjectOutput - resourceName := "aws_s3_bucket_object.object" + resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ @@ -613,7 +613,7 @@ func TestAccS3BucketObject_acl(t *testing.T) { func TestAccS3BucketObject_metadata(t *testing.T) { rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) var obj s3.GetObjectOutput - resourceName := "aws_s3_bucket_object.object" + resourceName := "aws_s3_object.object" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(t) }, @@ -659,7 +659,7 @@ func TestAccS3BucketObject_metadata(t *testing.T) { func TestAccS3BucketObject_storageClass(t *testing.T) { var obj s3.GetObjectOutput - resourceName := "aws_s3_bucket_object.object" + resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ @@ -723,7 +723,7 @@ func TestAccS3BucketObject_storageClass(t *testing.T) { func TestAccS3BucketObject_tags(t *testing.T) { var obj1, obj2, obj3, obj4 s3.GetObjectOutput rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - resourceName := "aws_s3_bucket_object.object" + resourceName := "aws_s3_object.object" key := "test-key" resource.ParallelTest(t, resource.TestCase{ @@ -795,7 +795,7 @@ func TestAccS3BucketObject_tags(t *testing.T) { func TestAccS3BucketObject_tagsLeadingSingleSlash(t *testing.T) { var obj1, obj2, obj3, obj4 s3.GetObjectOutput rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - resourceName := "aws_s3_bucket_object.object" + resourceName := "aws_s3_object.object" key := "/test-key" resource.ParallelTest(t, resource.TestCase{ @@ -867,7 +867,7 @@ func TestAccS3BucketObject_tagsLeadingSingleSlash(t *testing.T) { func TestAccS3BucketObject_tagsLeadingMultipleSlashes(t *testing.T) { var obj1, obj2, obj3, obj4 s3.GetObjectOutput rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - resourceName := "aws_s3_bucket_object.object" + resourceName := "aws_s3_object.object" key := "/////test-key" resource.ParallelTest(t, resource.TestCase{ @@ -932,7 +932,7 @@ func TestAccS3BucketObject_tagsLeadingMultipleSlashes(t *testing.T) { func TestAccS3BucketObject_tagsMultipleSlashes(t *testing.T) { var obj1, obj2, obj3, obj4 s3.GetObjectOutput rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - resourceName := "aws_s3_bucket_object.object" + resourceName := "aws_s3_object.object" key := "first//second///third//" resource.ParallelTest(t, resource.TestCase{ @@ -996,7 +996,7 @@ func TestAccS3BucketObject_tagsMultipleSlashes(t *testing.T) { func TestAccS3BucketObject_objectLockLegalHoldStartWithNone(t *testing.T) { var obj1, obj2, obj3 s3.GetObjectOutput - resourceName := "aws_s3_bucket_object.object" + resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ @@ -1044,7 +1044,7 @@ func TestAccS3BucketObject_objectLockLegalHoldStartWithNone(t *testing.T) { func TestAccS3BucketObject_objectLockLegalHoldStartWithOn(t *testing.T) { var obj1, obj2 s3.GetObjectOutput - resourceName := "aws_s3_bucket_object.object" + resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ @@ -1080,7 +1080,7 @@ func TestAccS3BucketObject_objectLockLegalHoldStartWithOn(t *testing.T) { func TestAccS3BucketObject_objectLockRetentionStartWithNone(t *testing.T) { var obj1, obj2, obj3 s3.GetObjectOutput - resourceName := "aws_s3_bucket_object.object" + resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) retainUntilDate := time.Now().UTC().AddDate(0, 0, 10).Format(time.RFC3339) @@ -1129,7 +1129,7 @@ func TestAccS3BucketObject_objectLockRetentionStartWithNone(t *testing.T) { func TestAccS3BucketObject_objectLockRetentionStartWithSet(t *testing.T) { var obj1, obj2, obj3, obj4 s3.GetObjectOutput - resourceName := "aws_s3_bucket_object.object" + resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) retainUntilDate1 := time.Now().UTC().AddDate(0, 0, 20).Format(time.RFC3339) retainUntilDate2 := time.Now().UTC().AddDate(0, 0, 30).Format(time.RFC3339) @@ -1190,7 +1190,7 @@ func TestAccS3BucketObject_objectLockRetentionStartWithSet(t *testing.T) { func TestAccS3BucketObject_objectBucketKeyEnabled(t *testing.T) { var obj s3.GetObjectOutput - resourceName := "aws_s3_bucket_object.object" + resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ @@ -1213,7 +1213,7 @@ func TestAccS3BucketObject_objectBucketKeyEnabled(t *testing.T) { func TestAccS3BucketObject_bucketBucketKeyEnabled(t *testing.T) { var obj s3.GetObjectOutput - resourceName := "aws_s3_bucket_object.object" + resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ @@ -1236,7 +1236,7 @@ func TestAccS3BucketObject_bucketBucketKeyEnabled(t *testing.T) { func TestAccS3BucketObject_defaultBucketSSE(t *testing.T) { var obj1 s3.GetObjectOutput - resourceName := "aws_s3_bucket_object.object" + resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ @@ -1259,7 +1259,7 @@ func TestAccS3BucketObject_defaultBucketSSE(t *testing.T) { func TestAccS3BucketObject_ignoreTags(t *testing.T) { var obj s3.GetObjectOutput rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - resourceName := "aws_s3_bucket_object.object" + resourceName := "aws_s3_object.object" key := "test-key" var providers []*schema.Provider @@ -1346,7 +1346,7 @@ func testAccCheckBucketObjectDestroy(s *terraform.State) error { conn := acctest.Provider.Meta().(*conns.AWSClient).S3Conn for _, rs := range s.RootModule().Resources { - if rs.Type != "aws_s3_bucket_object" { + if rs.Type != "aws_s3_object" { continue } @@ -1562,7 +1562,7 @@ func testAccCheckBucketObjectCheckTags(n string, expectedTags map[string]string) func testAccBucketObjectBasicConfig(bucket, key string) string { return fmt.Sprintf(` -resource "aws_s3_bucket_object" "object" { +resource "aws_s3_object" "object" { bucket = %[1]q key = %[2]q } @@ -1575,7 +1575,7 @@ resource "aws_s3_bucket" "test" { bucket = %[1]q } -resource "aws_s3_bucket_object" "object" { +resource "aws_s3_object" "object" { bucket = aws_s3_bucket.test.bucket key = "test-key" } @@ -1588,7 +1588,7 @@ resource "aws_s3_bucket" "test" { bucket = %[1]q } -resource "aws_s3_bucket_object" "object" { +resource "aws_s3_object" "object" { bucket = aws_s3_bucket.test.bucket key = "test-key" source = %[2]q @@ -1603,7 +1603,7 @@ resource "aws_s3_bucket" "test" { bucket = %[1]q } -resource "aws_s3_bucket_object" "object" { +resource "aws_s3_object" "object" { bucket = aws_s3_bucket.test.bucket key = "test-key" source = %[2]q @@ -1620,7 +1620,7 @@ resource "aws_s3_bucket" "test" { bucket = %[1]q } -resource "aws_s3_bucket_object" "object" { +resource "aws_s3_object" "object" { bucket = aws_s3_bucket.test.bucket key = "test-key" content = %[2]q @@ -1634,7 +1634,7 @@ resource "aws_s3_bucket" "test" { bucket = %[1]q } -resource "aws_s3_bucket_object" "object" { +resource "aws_s3_object" "object" { bucket = aws_s3_bucket.test.bucket key = "test-key" server_side_encryption = "AES256" @@ -1650,7 +1650,7 @@ resource "aws_s3_bucket" "test" { bucket = %[1]q } -resource "aws_s3_bucket_object" "object" { +resource "aws_s3_object" "object" { bucket = aws_s3_bucket.test.bucket key = "test-key" content_base64 = %[2]q @@ -1664,7 +1664,7 @@ resource "aws_s3_bucket" "test" { bucket = %[1]q } -resource "aws_s3_bucket_object" "object" { +resource "aws_s3_object" "object" { bucket = aws_s3_bucket.test.bucket key = "test-key" source = %[2]q @@ -1683,7 +1683,7 @@ resource "aws_s3_bucket" "object_bucket_3" { } } -resource "aws_s3_bucket_object" "object" { +resource "aws_s3_object" "object" { bucket = aws_s3_bucket.object_bucket_3.bucket key = "updateable-key" source = %[3]q @@ -1707,7 +1707,7 @@ resource "aws_s3_access_point" "test" { name = %[1]q } -resource "aws_s3_bucket_object" "test" { +resource "aws_s3_object" "test" { bucket = aws_s3_access_point.test.arn key = "updateable-key" source = %[3]q @@ -1724,7 +1724,7 @@ resource "aws_s3_bucket" "test" { bucket = %[1]q } -resource "aws_s3_bucket_object" "object" { +resource "aws_s3_object" "object" { bucket = aws_s3_bucket.test.bucket key = "test-key" source = %[2]q @@ -1739,7 +1739,7 @@ resource "aws_s3_bucket" "test" { bucket = %[1]q } -resource "aws_s3_bucket_object" "object" { +resource "aws_s3_object" "object" { bucket = aws_s3_bucket.test.bucket key = "test-key" source = %[2]q @@ -1758,7 +1758,7 @@ resource "aws_s3_bucket" "test" { } } -resource "aws_s3_bucket_object" "object" { +resource "aws_s3_object" "object" { bucket = aws_s3_bucket.test.bucket key = "test-key" content = %[2]q @@ -1773,7 +1773,7 @@ resource "aws_s3_bucket" "test" { bucket = %[1]q } -resource "aws_s3_bucket_object" "object" { +resource "aws_s3_object" "object" { bucket = aws_s3_bucket.test.bucket key = "test-key" content = "some_bucket_content" @@ -1792,7 +1792,7 @@ resource "aws_s3_bucket" "test" { } } -resource "aws_s3_bucket_object" "object" { +resource "aws_s3_object" "object" { bucket = aws_s3_bucket.test.bucket key = %[2]q content = %[3]q @@ -1816,7 +1816,7 @@ resource "aws_s3_bucket" "test" { } } -resource "aws_s3_bucket_object" "object" { +resource "aws_s3_object" "object" { bucket = aws_s3_bucket.test.bucket key = %[2]q content = %[3]q @@ -1841,7 +1841,7 @@ resource "aws_s3_bucket" "test" { } } -resource "aws_s3_bucket_object" "object" { +resource "aws_s3_object" "object" { bucket = aws_s3_bucket.test.bucket key = %[2]q content = %[3]q @@ -1855,7 +1855,7 @@ resource "aws_s3_bucket" "test" { bucket = %[1]q } -resource "aws_s3_bucket_object" "object" { +resource "aws_s3_object" "object" { bucket = aws_s3_bucket.test.bucket key = "test-key" @@ -1881,7 +1881,7 @@ resource "aws_s3_bucket" "test" { } } -resource "aws_s3_bucket_object" "object" { +resource "aws_s3_object" "object" { bucket = aws_s3_bucket.test.bucket key = "test-key" content = %[2]q @@ -1904,7 +1904,7 @@ resource "aws_s3_bucket" "test" { } } -resource "aws_s3_bucket_object" "object" { +resource "aws_s3_object" "object" { bucket = aws_s3_bucket.test.bucket key = "test-key" content = %[2]q @@ -1928,7 +1928,7 @@ resource "aws_s3_bucket" "test" { } } -resource "aws_s3_bucket_object" "object" { +resource "aws_s3_object" "object" { bucket = aws_s3_bucket.test.bucket key = "test-key" content = %[2]q @@ -1951,7 +1951,7 @@ resource "aws_s3_bucket" "test" { } } -resource "aws_s3_bucket_object" "object" { +resource "aws_s3_object" "object" { bucket = aws_s3_bucket.test.bucket key = "test-key" content = %[2]q @@ -1989,7 +1989,7 @@ resource "aws_s3_bucket" "object_bucket_3" { bucket = %[1]q } -resource "aws_s3_bucket_object" "object" { +resource "aws_s3_object" "object" { bucket = aws_s3_bucket.object_bucket_3.bucket key = "updateable-key" source = %[2]q @@ -2009,7 +2009,7 @@ resource "aws_s3_bucket" "test" { bucket = %[1]q } -resource "aws_s3_bucket_object" "object" { +resource "aws_s3_object" "object" { bucket = aws_s3_bucket.test.bucket key = "test-key" content = %q @@ -2040,7 +2040,7 @@ resource "aws_s3_bucket" "test" { } } -resource "aws_s3_bucket_object" "object" { +resource "aws_s3_object" "object" { bucket = aws_s3_bucket.test.bucket key = "test-key" content = %q @@ -2067,7 +2067,7 @@ resource "aws_s3_bucket" "test" { } } -resource "aws_s3_bucket_object" "object" { +resource "aws_s3_object" "object" { bucket = aws_s3_bucket.test.bucket key = "test-key" content = %[2]q diff --git a/internal/service/s3/bucket_objects_data_source_test.go b/internal/service/s3/bucket_objects_data_source_test.go index 54b2beb3c27..8c13beaa912 100644 --- a/internal/service/s3/bucket_objects_data_source_test.go +++ b/internal/service/s3/bucket_objects_data_source_test.go @@ -27,10 +27,10 @@ func TestAccS3BucketObjectsDataSource_basic(t *testing.T) { { Config: testAccObjectsBasicDataSourceConfig(rInt), Check: resource.ComposeTestCheckFunc( - testAccCheckObjectsExistsDataSource("data.aws_s3_bucket_objects.yesh"), - resource.TestCheckResourceAttr("data.aws_s3_bucket_objects.yesh", "keys.#", "2"), - resource.TestCheckResourceAttr("data.aws_s3_bucket_objects.yesh", "keys.0", "arch/navajo/north_window"), - resource.TestCheckResourceAttr("data.aws_s3_bucket_objects.yesh", "keys.1", "arch/navajo/sand_dune"), + testAccCheckObjectsExistsDataSource("data.aws_s3_objects.yesh"), + resource.TestCheckResourceAttr("data.aws_s3_objects.yesh", "keys.#", "2"), + resource.TestCheckResourceAttr("data.aws_s3_objects.yesh", "keys.0", "arch/navajo/north_window"), + resource.TestCheckResourceAttr("data.aws_s3_objects.yesh", "keys.1", "arch/navajo/sand_dune"), ), }, }, @@ -53,10 +53,10 @@ func TestAccS3BucketObjectsDataSource_basicViaAccessPoint(t *testing.T) { { Config: testAccObjectsBasicViaAccessPointDataSourceConfig(rInt), Check: resource.ComposeTestCheckFunc( - testAccCheckObjectsExistsDataSource("data.aws_s3_bucket_objects.yesh"), - resource.TestCheckResourceAttr("data.aws_s3_bucket_objects.yesh", "keys.#", "2"), - resource.TestCheckResourceAttr("data.aws_s3_bucket_objects.yesh", "keys.0", "arch/navajo/north_window"), - resource.TestCheckResourceAttr("data.aws_s3_bucket_objects.yesh", "keys.1", "arch/navajo/sand_dune"), + testAccCheckObjectsExistsDataSource("data.aws_s3_objects.yesh"), + resource.TestCheckResourceAttr("data.aws_s3_objects.yesh", "keys.#", "2"), + resource.TestCheckResourceAttr("data.aws_s3_objects.yesh", "keys.0", "arch/navajo/north_window"), + resource.TestCheckResourceAttr("data.aws_s3_objects.yesh", "keys.1", "arch/navajo/sand_dune"), ), }, }, @@ -79,15 +79,15 @@ func TestAccS3BucketObjectsDataSource_all(t *testing.T) { { Config: testAccObjectsAllDataSourceConfig(rInt), Check: resource.ComposeTestCheckFunc( - testAccCheckObjectsExistsDataSource("data.aws_s3_bucket_objects.yesh"), - resource.TestCheckResourceAttr("data.aws_s3_bucket_objects.yesh", "keys.#", "7"), - resource.TestCheckResourceAttr("data.aws_s3_bucket_objects.yesh", "keys.0", "arch/courthouse_towers/landscape"), - resource.TestCheckResourceAttr("data.aws_s3_bucket_objects.yesh", "keys.1", "arch/navajo/north_window"), - resource.TestCheckResourceAttr("data.aws_s3_bucket_objects.yesh", "keys.2", "arch/navajo/sand_dune"), - resource.TestCheckResourceAttr("data.aws_s3_bucket_objects.yesh", "keys.3", "arch/partition/park_avenue"), - resource.TestCheckResourceAttr("data.aws_s3_bucket_objects.yesh", "keys.4", "arch/rubicon"), - resource.TestCheckResourceAttr("data.aws_s3_bucket_objects.yesh", "keys.5", "arch/three_gossips/broken"), - resource.TestCheckResourceAttr("data.aws_s3_bucket_objects.yesh", "keys.6", "arch/three_gossips/turret"), + testAccCheckObjectsExistsDataSource("data.aws_s3_objects.yesh"), + resource.TestCheckResourceAttr("data.aws_s3_objects.yesh", "keys.#", "7"), + resource.TestCheckResourceAttr("data.aws_s3_objects.yesh", "keys.0", "arch/courthouse_towers/landscape"), + resource.TestCheckResourceAttr("data.aws_s3_objects.yesh", "keys.1", "arch/navajo/north_window"), + resource.TestCheckResourceAttr("data.aws_s3_objects.yesh", "keys.2", "arch/navajo/sand_dune"), + resource.TestCheckResourceAttr("data.aws_s3_objects.yesh", "keys.3", "arch/partition/park_avenue"), + resource.TestCheckResourceAttr("data.aws_s3_objects.yesh", "keys.4", "arch/rubicon"), + resource.TestCheckResourceAttr("data.aws_s3_objects.yesh", "keys.5", "arch/three_gossips/broken"), + resource.TestCheckResourceAttr("data.aws_s3_objects.yesh", "keys.6", "arch/three_gossips/turret"), ), }, }, @@ -110,14 +110,14 @@ func TestAccS3BucketObjectsDataSource_prefixes(t *testing.T) { { Config: testAccObjectsPrefixesDataSourceConfig(rInt), Check: resource.ComposeTestCheckFunc( - testAccCheckObjectsExistsDataSource("data.aws_s3_bucket_objects.yesh"), - resource.TestCheckResourceAttr("data.aws_s3_bucket_objects.yesh", "keys.#", "1"), - resource.TestCheckResourceAttr("data.aws_s3_bucket_objects.yesh", "keys.0", "arch/rubicon"), - resource.TestCheckResourceAttr("data.aws_s3_bucket_objects.yesh", "common_prefixes.#", "4"), - resource.TestCheckResourceAttr("data.aws_s3_bucket_objects.yesh", "common_prefixes.0", "arch/courthouse_towers/"), - resource.TestCheckResourceAttr("data.aws_s3_bucket_objects.yesh", "common_prefixes.1", "arch/navajo/"), - resource.TestCheckResourceAttr("data.aws_s3_bucket_objects.yesh", "common_prefixes.2", "arch/partition/"), - resource.TestCheckResourceAttr("data.aws_s3_bucket_objects.yesh", "common_prefixes.3", "arch/three_gossips/"), + testAccCheckObjectsExistsDataSource("data.aws_s3_objects.yesh"), + resource.TestCheckResourceAttr("data.aws_s3_objects.yesh", "keys.#", "1"), + resource.TestCheckResourceAttr("data.aws_s3_objects.yesh", "keys.0", "arch/rubicon"), + resource.TestCheckResourceAttr("data.aws_s3_objects.yesh", "common_prefixes.#", "4"), + resource.TestCheckResourceAttr("data.aws_s3_objects.yesh", "common_prefixes.0", "arch/courthouse_towers/"), + resource.TestCheckResourceAttr("data.aws_s3_objects.yesh", "common_prefixes.1", "arch/navajo/"), + resource.TestCheckResourceAttr("data.aws_s3_objects.yesh", "common_prefixes.2", "arch/partition/"), + resource.TestCheckResourceAttr("data.aws_s3_objects.yesh", "common_prefixes.3", "arch/three_gossips/"), ), }, }, @@ -140,10 +140,10 @@ func TestAccS3BucketObjectsDataSource_encoded(t *testing.T) { { Config: testAccObjectsEncodedDataSourceConfig(rInt), Check: resource.ComposeTestCheckFunc( - testAccCheckObjectsExistsDataSource("data.aws_s3_bucket_objects.yesh"), - resource.TestCheckResourceAttr("data.aws_s3_bucket_objects.yesh", "keys.#", "2"), - resource.TestCheckResourceAttr("data.aws_s3_bucket_objects.yesh", "keys.0", "arch/ru+b+ic+on"), - resource.TestCheckResourceAttr("data.aws_s3_bucket_objects.yesh", "keys.1", "arch/rubicon"), + testAccCheckObjectsExistsDataSource("data.aws_s3_objects.yesh"), + resource.TestCheckResourceAttr("data.aws_s3_objects.yesh", "keys.#", "2"), + resource.TestCheckResourceAttr("data.aws_s3_objects.yesh", "keys.0", "arch/ru+b+ic+on"), + resource.TestCheckResourceAttr("data.aws_s3_objects.yesh", "keys.1", "arch/rubicon"), ), }, }, @@ -166,10 +166,10 @@ func TestAccS3BucketObjectsDataSource_maxKeys(t *testing.T) { { Config: testAccObjectsMaxKeysDataSourceConfig(rInt), Check: resource.ComposeTestCheckFunc( - testAccCheckObjectsExistsDataSource("data.aws_s3_bucket_objects.yesh"), - resource.TestCheckResourceAttr("data.aws_s3_bucket_objects.yesh", "keys.#", "2"), - resource.TestCheckResourceAttr("data.aws_s3_bucket_objects.yesh", "keys.0", "arch/courthouse_towers/landscape"), - resource.TestCheckResourceAttr("data.aws_s3_bucket_objects.yesh", "keys.1", "arch/navajo/north_window"), + testAccCheckObjectsExistsDataSource("data.aws_s3_objects.yesh"), + resource.TestCheckResourceAttr("data.aws_s3_objects.yesh", "keys.#", "2"), + resource.TestCheckResourceAttr("data.aws_s3_objects.yesh", "keys.0", "arch/courthouse_towers/landscape"), + resource.TestCheckResourceAttr("data.aws_s3_objects.yesh", "keys.1", "arch/navajo/north_window"), ), }, }, @@ -192,9 +192,9 @@ func TestAccS3BucketObjectsDataSource_startAfter(t *testing.T) { { Config: testAccObjectsStartAfterDataSourceConfig(rInt), Check: resource.ComposeTestCheckFunc( - testAccCheckObjectsExistsDataSource("data.aws_s3_bucket_objects.yesh"), - resource.TestCheckResourceAttr("data.aws_s3_bucket_objects.yesh", "keys.#", "1"), - resource.TestCheckResourceAttr("data.aws_s3_bucket_objects.yesh", "keys.0", "arch/three_gossips/turret"), + testAccCheckObjectsExistsDataSource("data.aws_s3_objects.yesh"), + resource.TestCheckResourceAttr("data.aws_s3_objects.yesh", "keys.#", "1"), + resource.TestCheckResourceAttr("data.aws_s3_objects.yesh", "keys.0", "arch/three_gossips/turret"), ), }, }, @@ -217,9 +217,9 @@ func TestAccS3BucketObjectsDataSource_fetchOwner(t *testing.T) { { Config: testAccObjectsOwnersDataSourceConfig(rInt), Check: resource.ComposeTestCheckFunc( - testAccCheckObjectsExistsDataSource("data.aws_s3_bucket_objects.yesh"), - resource.TestCheckResourceAttr("data.aws_s3_bucket_objects.yesh", "keys.#", "2"), - resource.TestCheckResourceAttr("data.aws_s3_bucket_objects.yesh", "owners.#", "2"), + testAccCheckObjectsExistsDataSource("data.aws_s3_objects.yesh"), + resource.TestCheckResourceAttr("data.aws_s3_objects.yesh", "keys.#", "2"), + resource.TestCheckResourceAttr("data.aws_s3_objects.yesh", "owners.#", "2"), ), }, }, @@ -247,43 +247,43 @@ resource "aws_s3_bucket" "objects_bucket" { bucket = "tf-acc-objects-test-bucket-%d" } -resource "aws_s3_bucket_object" "object1" { +resource "aws_s3_object" "object1" { bucket = aws_s3_bucket.objects_bucket.id key = "arch/three_gossips/turret" content = "Delicate" } -resource "aws_s3_bucket_object" "object2" { +resource "aws_s3_object" "object2" { bucket = aws_s3_bucket.objects_bucket.id key = "arch/three_gossips/broken" content = "Dark Angel" } -resource "aws_s3_bucket_object" "object3" { +resource "aws_s3_object" "object3" { bucket = aws_s3_bucket.objects_bucket.id key = "arch/navajo/north_window" content = "Balanced Rock" } -resource "aws_s3_bucket_object" "object4" { +resource "aws_s3_object" "object4" { bucket = aws_s3_bucket.objects_bucket.id key = "arch/navajo/sand_dune" content = "Queen Victoria Rock" } -resource "aws_s3_bucket_object" "object5" { +resource "aws_s3_object" "object5" { bucket = aws_s3_bucket.objects_bucket.id key = "arch/partition/park_avenue" content = "Double-O" } -resource "aws_s3_bucket_object" "object6" { +resource "aws_s3_object" "object6" { bucket = aws_s3_bucket.objects_bucket.id key = "arch/courthouse_towers/landscape" content = "Fiery Furnace" } -resource "aws_s3_bucket_object" "object7" { +resource "aws_s3_object" "object7" { bucket = aws_s3_bucket.objects_bucket.id key = "arch/rubicon" content = "Devils Garden" @@ -304,7 +304,7 @@ func testAccObjectsBasicDataSourceConfig(randInt int) string { return fmt.Sprintf(` %s -data "aws_s3_bucket_objects" "yesh" { +data "aws_s3_objects" "yesh" { bucket = aws_s3_bucket.objects_bucket.id prefix = "arch/navajo/" delimiter = "/" @@ -314,7 +314,7 @@ data "aws_s3_bucket_objects" "yesh" { func testAccObjectsBasicViaAccessPointDataSourceConfig(randInt int) string { return testAccObjectsResourcesPlusAccessPointDataSourceConfig(randInt) + ` -data "aws_s3_bucket_objects" "yesh" { +data "aws_s3_objects" "yesh" { bucket = aws_s3_access_point.test.arn prefix = "arch/navajo/" delimiter = "/" @@ -326,7 +326,7 @@ func testAccObjectsAllDataSourceConfig(randInt int) string { return fmt.Sprintf(` %s -data "aws_s3_bucket_objects" "yesh" { +data "aws_s3_objects" "yesh" { bucket = aws_s3_bucket.objects_bucket.id } `, testAccObjectsResourcesDataSourceConfig(randInt)) @@ -336,7 +336,7 @@ func testAccObjectsPrefixesDataSourceConfig(randInt int) string { return fmt.Sprintf(` %s -data "aws_s3_bucket_objects" "yesh" { +data "aws_s3_objects" "yesh" { bucket = aws_s3_bucket.objects_bucket.id prefix = "arch/" delimiter = "/" @@ -348,7 +348,7 @@ func testAccObjectsExtraResourceDataSourceConfig(randInt int) string { return fmt.Sprintf(` %s -resource "aws_s3_bucket_object" "object8" { +resource "aws_s3_object" "object8" { bucket = aws_s3_bucket.objects_bucket.id key = "arch/ru b ic on" content = "Goose Island" @@ -360,7 +360,7 @@ func testAccObjectsEncodedDataSourceConfig(randInt int) string { return fmt.Sprintf(` %s -data "aws_s3_bucket_objects" "yesh" { +data "aws_s3_objects" "yesh" { bucket = aws_s3_bucket.objects_bucket.id encoding_type = "url" prefix = "arch/ru" @@ -372,7 +372,7 @@ func testAccObjectsMaxKeysDataSourceConfig(randInt int) string { return fmt.Sprintf(` %s -data "aws_s3_bucket_objects" "yesh" { +data "aws_s3_objects" "yesh" { bucket = aws_s3_bucket.objects_bucket.id max_keys = 2 } @@ -383,7 +383,7 @@ func testAccObjectsStartAfterDataSourceConfig(randInt int) string { return fmt.Sprintf(` %s -data "aws_s3_bucket_objects" "yesh" { +data "aws_s3_objects" "yesh" { bucket = aws_s3_bucket.objects_bucket.id start_after = "arch/three_gossips/broken" } @@ -394,7 +394,7 @@ func testAccObjectsOwnersDataSourceConfig(randInt int) string { return fmt.Sprintf(` %s -data "aws_s3_bucket_objects" "yesh" { +data "aws_s3_objects" "yesh" { bucket = aws_s3_bucket.objects_bucket.id prefix = "arch/three_gossips/" fetch_owner = true diff --git a/internal/service/s3/bucket_test.go b/internal/service/s3/bucket_test.go index 491029b2bd0..0ca48e2f65e 100644 --- a/internal/service/s3/bucket_test.go +++ b/internal/service/s3/bucket_test.go @@ -2580,7 +2580,7 @@ func TestAccS3Bucket_Basic_forceDestroy(t *testing.T) { // By default, the AWS Go SDK cleans up URIs by removing extra slashes // when the service API requests use the URI as part of making a request. -// While the aws_s3_bucket_object resource automatically cleans the key +// While the aws_s3_object resource automatically cleans the key // to not contain these extra slashes, out-of-band handling and other AWS // services may create keys with extra slashes (empty "directory" prefixes). func TestAccS3Bucket_Basic_forceDestroyWithEmptyPrefixes(t *testing.T) { diff --git a/internal/service/s3/object_copy_test.go b/internal/service/s3/object_copy_test.go index 97a18348325..ecfb04d0e59 100644 --- a/internal/service/s3/object_copy_test.go +++ b/internal/service/s3/object_copy_test.go @@ -17,7 +17,7 @@ func TestAccS3ObjectCopy_basic(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object_copy.test" - sourceName := "aws_s3_bucket_object.source" + sourceName := "aws_s3_object.source" key := "HundBegraven" sourceKey := "WshngtnNtnls" @@ -136,7 +136,7 @@ resource "aws_s3_bucket" "source" { bucket = %[1]q } -resource "aws_s3_bucket_object" "source" { +resource "aws_s3_object" "source" { bucket = aws_s3_bucket.source.bucket key = %[2]q content = "Ingen ko på isen" @@ -149,7 +149,7 @@ resource "aws_s3_bucket" "target" { resource "aws_s3_object_copy" "test" { bucket = aws_s3_bucket.target.bucket key = %[4]q - source = "${aws_s3_bucket.source.bucket}/${aws_s3_bucket_object.source.key}" + source = "${aws_s3_bucket.source.bucket}/${aws_s3_object.source.key}" grant { uri = "http://acs.amazonaws.com/groups/global/AllUsers" @@ -171,7 +171,7 @@ resource "aws_s3_bucket" "source" { bucket = "%[1]s-source" } -resource "aws_s3_bucket_object" "source" { +resource "aws_s3_object" "source" { bucket = aws_s3_bucket.source.bucket content = "Ingen ko på isen" key = "test" @@ -194,7 +194,7 @@ resource "aws_s3_bucket" "target" { resource "aws_s3_object_copy" "test" { bucket = aws_s3_bucket.target.bucket key = "test" - source = "${aws_s3_bucket.source.bucket}/${aws_s3_bucket_object.source.key}" + source = "${aws_s3_bucket.source.bucket}/${aws_s3_object.source.key}" } `, rName) } @@ -210,7 +210,7 @@ resource "aws_s3_bucket" "source" { bucket = "%[1]s-source" } -resource "aws_s3_bucket_object" "source" { +resource "aws_s3_object" "source" { bucket = aws_s3_bucket.source.bucket content = "Ingen ko på isen" key = "test" @@ -225,7 +225,7 @@ resource "aws_s3_object_copy" "test" { bucket_key_enabled = true key = "test" kms_key_id = aws_kms_key.test.arn - source = "${aws_s3_bucket.source.bucket}/${aws_s3_bucket_object.source.key}" + source = "${aws_s3_bucket.source.bucket}/${aws_s3_object.source.key}" } `, rName) } diff --git a/internal/service/s3/sweep.go b/internal/service/s3/sweep.go index 849816cf0e0..7ba3b87f31b 100644 --- a/internal/service/s3/sweep.go +++ b/internal/service/s3/sweep.go @@ -22,8 +22,8 @@ import ( ) func init() { - resource.AddTestSweepers("aws_s3_bucket_object", &resource.Sweeper{ - Name: "aws_s3_bucket_object", + resource.AddTestSweepers("aws_s3_object", &resource.Sweeper{ + Name: "aws_s3_object", F: sweepBucketObjects, }) @@ -32,7 +32,7 @@ func init() { F: sweepBuckets, Dependencies: []string{ "aws_s3_access_point", - "aws_s3_bucket_object", + "aws_s3_object", "aws_s3control_multi_region_access_point", }, }) From 41bb4b062a2347ad21606b718d4fdb6f256bd1b6 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Mon, 31 Jan 2022 12:15:49 -0500 Subject: [PATCH 04/17] tests: Update tests --- .../service/apigateway/domain_name_test.go | 8 +-- .../service/apigatewayv2/domain_name_test.go | 12 ++-- .../service/cloudformation/stack_set_test.go | 8 +-- internal/service/cloudformation/stack_test.go | 8 +-- .../cloudformation/type_data_source_test.go | 4 +- internal/service/cloudformation/type_test.go | 8 +-- internal/service/codebuild/project_test.go | 8 +-- .../configservice/conformance_pack_test.go | 8 +-- .../organization_conformance_pack_test.go | 4 +- .../service/ec2/ebs_snapshot_import_test.go | 12 ++-- .../application_version_test.go | 18 ++--- .../elasticbeanstalk/environment_test.go | 8 +-- internal/service/emr/cluster_test.go | 8 +-- internal/service/guardduty/ipset_test.go | 12 ++-- .../service/guardduty/threatintelset_test.go | 12 ++-- .../service/imagebuilder/component_test.go | 4 +- .../custom_plugin_data_source_test.go | 2 +- .../kafkaconnect/custom_plugin_test.go | 20 +++--- .../kinesisanalyticsv2/application_test.go | 66 +++++++++---------- internal/service/lambda/function_test.go | 18 ++--- internal/service/lambda/layer_version_test.go | 4 +- internal/service/mwaa/environment_test.go | 28 ++++---- .../service/quicksight/data_source_test.go | 12 ++-- internal/service/rds/cluster_test.go | 2 +- internal/service/rds/instance_test.go | 2 +- internal/service/sagemaker/endpoint_test.go | 4 +- internal/service/sagemaker/model_test.go | 4 +- internal/service/sagemaker/project_test.go | 4 +- .../service/servicecatalog/constraint_test.go | 4 +- .../service/servicecatalog/product_test.go | 6 +- .../provisioned_product_test.go | 4 +- .../provisioning_artifact_test.go | 8 +-- .../signer/signing_job_data_source_test.go | 8 +-- internal/service/signer/signing_job_test.go | 8 +-- internal/service/ssm/document_test.go | 6 +- internal/service/synthetics/canary_test.go | 8 +-- 36 files changed, 180 insertions(+), 180 deletions(-) diff --git a/internal/service/apigateway/domain_name_test.go b/internal/service/apigateway/domain_name_test.go index ac8db5fac72..56178ef56da 100644 --- a/internal/service/apigateway/domain_name_test.go +++ b/internal/service/apigateway/domain_name_test.go @@ -305,7 +305,7 @@ func TestAccAPIGatewayDomainName_mutualTLSAuthentication(t *testing.T) { var v apigateway.DomainName resourceName := "aws_api_gateway_domain_name.test" acmCertificateResourceName := "aws_acm_certificate.test" - s3BucketObjectResourceName := "aws_s3_bucket_object.test" + s3BucketObjectResourceName := "aws_s3_object.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ @@ -647,7 +647,7 @@ resource "aws_s3_bucket" "test" { } } -resource "aws_s3_bucket_object" "test" { +resource "aws_s3_object" "test" { bucket = aws_s3_bucket.test.id key = %[1]q source = "test-fixtures/apigateway-domain-name-truststore-1.pem" @@ -663,8 +663,8 @@ resource "aws_api_gateway_domain_name" "test" { } mutual_tls_authentication { - truststore_uri = "s3://${aws_s3_bucket_object.test.bucket}/${aws_s3_bucket_object.test.key}" - truststore_version = aws_s3_bucket_object.test.version_id + truststore_uri = "s3://${aws_s3_object.test.bucket}/${aws_s3_object.test.key}" + truststore_version = aws_s3_object.test.version_id } } `, rName)) diff --git a/internal/service/apigatewayv2/domain_name_test.go b/internal/service/apigatewayv2/domain_name_test.go index 1cd042d3902..0e8024d2073 100644 --- a/internal/service/apigatewayv2/domain_name_test.go +++ b/internal/service/apigatewayv2/domain_name_test.go @@ -221,7 +221,7 @@ func TestAccAPIGatewayV2DomainName_mutualTLSAuthentication(t *testing.T) { var v apigatewayv2.GetDomainNameOutput resourceName := "aws_apigatewayv2_domain_name.test" acmCertificateResourceName := "aws_acm_certificate.test" - s3BucketObjectResourceName := "aws_s3_bucket_object.test" + s3BucketObjectResourceName := "aws_s3_object.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ @@ -469,7 +469,7 @@ resource "aws_s3_bucket" "test" { force_destroy = true } -resource "aws_s3_bucket_object" "test" { +resource "aws_s3_object" "test" { bucket = aws_s3_bucket.test.id key = %[1]q source = "test-fixtures/%[2]s" @@ -485,7 +485,7 @@ resource "aws_apigatewayv2_domain_name" "test" { } mutual_tls_authentication { - truststore_uri = "s3://${aws_s3_bucket_object.test.bucket}/${aws_s3_bucket_object.test.key}" + truststore_uri = "s3://${aws_s3_object.test.bucket}/${aws_s3_object.test.key}" } } `, rName, pemFileName)) @@ -505,7 +505,7 @@ resource "aws_s3_bucket" "test" { } } -resource "aws_s3_bucket_object" "test" { +resource "aws_s3_object" "test" { bucket = aws_s3_bucket.test.id key = %[1]q source = "test-fixtures/%[2]s" @@ -521,8 +521,8 @@ resource "aws_apigatewayv2_domain_name" "test" { } mutual_tls_authentication { - truststore_uri = "s3://${aws_s3_bucket_object.test.bucket}/${aws_s3_bucket_object.test.key}" - truststore_version = aws_s3_bucket_object.test.version_id + truststore_uri = "s3://${aws_s3_object.test.bucket}/${aws_s3_object.test.key}" + truststore_version = aws_s3_object.test.version_id } } `, rName, pemFileName)) diff --git a/internal/service/cloudformation/stack_set_test.go b/internal/service/cloudformation/stack_set_test.go index 1cafd48cc2d..10fb87fd5c0 100644 --- a/internal/service/cloudformation/stack_set_test.go +++ b/internal/service/cloudformation/stack_set_test.go @@ -1348,7 +1348,7 @@ resource "aws_s3_bucket" "test" { bucket = %[1]q } -resource "aws_s3_bucket_object" "test" { +resource "aws_s3_object" "test" { acl = "public-read" bucket = aws_s3_bucket.test.bucket @@ -1362,7 +1362,7 @@ CONTENT resource "aws_cloudformation_stack_set" "test" { administration_role_arn = aws_iam_role.test.arn name = %[1]q - template_url = "https://${aws_s3_bucket.test.bucket_regional_domain_name}/${aws_s3_bucket_object.test.key}" + template_url = "https://${aws_s3_bucket.test.bucket_regional_domain_name}/${aws_s3_object.test.key}" } `, rName, testAccStackSetTemplateBodyVPC(rName+"1")) } @@ -1397,7 +1397,7 @@ resource "aws_s3_bucket" "test" { bucket = %[1]q } -resource "aws_s3_bucket_object" "test" { +resource "aws_s3_object" "test" { acl = "public-read" bucket = aws_s3_bucket.test.bucket @@ -1411,7 +1411,7 @@ CONTENT resource "aws_cloudformation_stack_set" "test" { administration_role_arn = aws_iam_role.test.arn name = %[1]q - template_url = "https://${aws_s3_bucket.test.bucket_regional_domain_name}/${aws_s3_bucket_object.test.key}" + template_url = "https://${aws_s3_bucket.test.bucket_regional_domain_name}/${aws_s3_object.test.key}" } `, rName, testAccStackSetTemplateBodyVPC(rName+"2")) } diff --git a/internal/service/cloudformation/stack_test.go b/internal/service/cloudformation/stack_test.go index 48af97c0bb8..fab244b7513 100644 --- a/internal/service/cloudformation/stack_test.go +++ b/internal/service/cloudformation/stack_test.go @@ -859,7 +859,7 @@ POLICY } } -resource "aws_s3_bucket_object" "object" { +resource "aws_s3_object" "object" { bucket = aws_s3_bucket.b.id key = %[2]q source = "test-fixtures/cloudformation-template.json" @@ -872,7 +872,7 @@ resource "aws_cloudformation_stack" "test" { VpcCIDR = %[3]q } - template_url = "https://${aws_s3_bucket.b.id}.s3-${data.aws_region.current.name}.${data.aws_partition.current.dns_suffix}/${aws_s3_bucket_object.object.key}" + template_url = "https://${aws_s3_bucket.b.id}.s3-${data.aws_region.current.name}.${data.aws_partition.current.dns_suffix}/${aws_s3_object.object.key}" on_failure = "DELETE" timeout_in_minutes = 1 } @@ -913,7 +913,7 @@ POLICY } } -resource "aws_s3_bucket_object" "object" { +resource "aws_s3_object" "object" { bucket = aws_s3_bucket.b.id key = %[2]q source = "test-fixtures/cloudformation-template.yaml" @@ -926,7 +926,7 @@ resource "aws_cloudformation_stack" "test" { VpcCIDR = %[3]q } - template_url = "https://${aws_s3_bucket.b.id}.s3-${data.aws_region.current.name}.${data.aws_partition.current.dns_suffix}/${aws_s3_bucket_object.object.key}" + template_url = "https://${aws_s3_bucket.b.id}.s3-${data.aws_region.current.name}.${data.aws_partition.current.dns_suffix}/${aws_s3_object.object.key}" on_failure = "DELETE" timeout_in_minutes = 1 } diff --git a/internal/service/cloudformation/type_data_source_test.go b/internal/service/cloudformation/type_data_source_test.go index f646af0da16..94d3dc8483c 100644 --- a/internal/service/cloudformation/type_data_source_test.go +++ b/internal/service/cloudformation/type_data_source_test.go @@ -150,14 +150,14 @@ resource "aws_s3_bucket" "test" { force_destroy = true } -resource "aws_s3_bucket_object" "test" { +resource "aws_s3_object" "test" { bucket = aws_s3_bucket.test.bucket key = "test" source = %[2]q } resource "aws_cloudformation_type" "test" { - schema_handler_package = "s3://${aws_s3_bucket_object.test.bucket}/${aws_s3_bucket_object.test.key}" + schema_handler_package = "s3://${aws_s3_object.test.bucket}/${aws_s3_object.test.key}" type = "RESOURCE" type_name = %[3]q } diff --git a/internal/service/cloudformation/type_test.go b/internal/service/cloudformation/type_test.go index 4f6b555f8a3..89ea941f2da 100644 --- a/internal/service/cloudformation/type_test.go +++ b/internal/service/cloudformation/type_test.go @@ -377,7 +377,7 @@ resource "aws_s3_bucket" "test" { force_destroy = true } -resource "aws_s3_bucket_object" "test" { +resource "aws_s3_object" "test" { bucket = aws_s3_bucket.test.bucket key = "test" source = %[2]q @@ -406,7 +406,7 @@ resource "aws_iam_role" "test" { resource "aws_cloudformation_type" "test" { execution_role_arn = aws_iam_role.test.arn - schema_handler_package = "s3://${aws_s3_bucket_object.test.bucket}/${aws_s3_bucket_object.test.key}" + schema_handler_package = "s3://${aws_s3_object.test.bucket}/${aws_s3_object.test.key}" type = "RESOURCE" type_name = %[2]q } @@ -437,7 +437,7 @@ resource "aws_iam_role" "test" { } resource "aws_cloudformation_type" "test" { - schema_handler_package = "s3://${aws_s3_bucket_object.test.bucket}/${aws_s3_bucket_object.test.key}" + schema_handler_package = "s3://${aws_s3_object.test.bucket}/${aws_s3_object.test.key}" type = "RESOURCE" type_name = %[2]q @@ -454,7 +454,7 @@ func testAccCloudformationTypeConfigTypeName(rName string, zipPath string, typeN testAccCloudformationTypeConfigBase(rName, zipPath), fmt.Sprintf(` resource "aws_cloudformation_type" "test" { - schema_handler_package = "s3://${aws_s3_bucket_object.test.bucket}/${aws_s3_bucket_object.test.key}" + schema_handler_package = "s3://${aws_s3_object.test.bucket}/${aws_s3_object.test.key}" type = "RESOURCE" type_name = %[1]q } diff --git a/internal/service/codebuild/project_test.go b/internal/service/codebuild/project_test.go index 9917c2399a4..2cfa74ad4a1 100644 --- a/internal/service/codebuild/project_test.go +++ b/internal/service/codebuild/project_test.go @@ -3171,7 +3171,7 @@ resource "aws_s3_bucket" "test" { force_destroy = true } -resource "aws_s3_bucket_object" "test" { +resource "aws_s3_object" "test" { bucket = aws_s3_bucket.test.bucket key = %[1]q content = "test" @@ -3189,7 +3189,7 @@ resource "aws_codebuild_project" "test" { compute_type = "BUILD_GENERAL1_SMALL" image = "2" type = "LINUX_CONTAINER" - certificate = "${aws_s3_bucket.test.bucket}/${aws_s3_bucket_object.test.key}" + certificate = "${aws_s3_bucket.test.bucket}/${aws_s3_object.test.key}" } source { @@ -3956,7 +3956,7 @@ resource "aws_s3_bucket" "test" { bucket = %[1]q } -resource "aws_s3_bucket_object" "test" { +resource "aws_s3_object" "test" { bucket = aws_s3_bucket.test.bucket content = "test" key = "test.txt" @@ -3977,7 +3977,7 @@ resource "aws_codebuild_project" "test" { } source { - location = "${aws_s3_bucket.test.bucket}/${aws_s3_bucket_object.test.key}" + location = "${aws_s3_bucket.test.bucket}/${aws_s3_object.test.key}" type = "S3" } } diff --git a/internal/service/configservice/conformance_pack_test.go b/internal/service/configservice/conformance_pack_test.go index 28141d408bd..ba32d579170 100644 --- a/internal/service/configservice/conformance_pack_test.go +++ b/internal/service/configservice/conformance_pack_test.go @@ -657,7 +657,7 @@ resource "aws_s3_bucket" "test" { force_destroy = true } -resource "aws_s3_bucket_object" "test" { +resource "aws_s3_object" "test" { bucket = aws_s3_bucket.test.id key = %[1]q content = < Date: Mon, 31 Jan 2022 12:18:32 -0500 Subject: [PATCH 05/17] s3/docs: Update docs --- website/docs/d/s3_bucket_object.html.markdown | 16 ++++++++-------- website/docs/d/s3_bucket_objects.html.markdown | 14 +++++++------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/website/docs/d/s3_bucket_object.html.markdown b/website/docs/d/s3_bucket_object.html.markdown index 590ffb876c2..88bf8a0894a 100644 --- a/website/docs/d/s3_bucket_object.html.markdown +++ b/website/docs/d/s3_bucket_object.html.markdown @@ -1,12 +1,12 @@ --- subcategory: "S3" layout: "aws" -page_title: "AWS: aws_s3_bucket_object" +page_title: "AWS: aws_s3_object" description: |- Provides metadata and optionally content of an S3 object --- -# Data Source: aws_s3_bucket_object +# Data Source: aws_s3_object The S3 object data source allows access to the metadata and _optionally_ (see below) content of an object stored inside S3 bucket. @@ -19,7 +19,7 @@ The following example retrieves a text object (which must have a `Content-Type` value starting with `text/`) and uses it as the `user_data` for an EC2 instance: ```terraform -data "aws_s3_bucket_object" "bootstrap_script" { +data "aws_s3_object" "bootstrap_script" { bucket = "ourcorp-deploy-config" key = "ec2-bootstrap-script.sh" } @@ -27,7 +27,7 @@ data "aws_s3_bucket_object" "bootstrap_script" { resource "aws_instance" "example" { instance_type = "t2.micro" ami = "ami-2757f631" - user_data = data.aws_s3_bucket_object.bootstrap_script.body + user_data = data.aws_s3_object.bootstrap_script.body } ``` @@ -38,15 +38,15 @@ Lambda functions is available in the documentation for [`aws_lambda_function`](/docs/providers/aws/r/lambda_function.html). ```terraform -data "aws_s3_bucket_object" "lambda" { +data "aws_s3_object" "lambda" { bucket = "ourcorp-lambda-functions" key = "hello-world.zip" } resource "aws_lambda_function" "test_lambda" { - s3_bucket = data.aws_s3_bucket_object.lambda.bucket - s3_key = data.aws_s3_bucket_object.lambda.key - s3_object_version = data.aws_s3_bucket_object.lambda.version_id + s3_bucket = data.aws_s3_object.lambda.bucket + s3_key = data.aws_s3_object.lambda.key + s3_object_version = data.aws_s3_object.lambda.version_id function_name = "lambda_function_name" role = aws_iam_role.iam_for_lambda.arn # (not shown) handler = "exports.test" diff --git a/website/docs/d/s3_bucket_objects.html.markdown b/website/docs/d/s3_bucket_objects.html.markdown index 8e246023c1f..1b488786070 100644 --- a/website/docs/d/s3_bucket_objects.html.markdown +++ b/website/docs/d/s3_bucket_objects.html.markdown @@ -1,12 +1,12 @@ --- subcategory: "S3" layout: "aws" -page_title: "AWS: aws_s3_bucket_objects" +page_title: "AWS: aws_s3_objects" description: |- Returns keys and metadata of S3 objects --- -# Data Source: aws_s3_bucket_objects +# Data Source: aws_s3_objects ~> **NOTE on `max_keys`:** Retrieving very large numbers of keys can adversely affect Terraform's performance. @@ -17,14 +17,14 @@ The bucket-objects data source returns keys (i.e., file names) and other metadat The following example retrieves a list of all object keys in an S3 bucket and creates corresponding Terraform object data sources: ```terraform -data "aws_s3_bucket_objects" "my_objects" { +data "aws_s3_objects" "my_objects" { bucket = "ourcorp" } -data "aws_s3_bucket_object" "object_info" { - count = length(data.aws_s3_bucket_objects.my_objects.keys) - key = element(data.aws_s3_bucket_objects.my_objects.keys, count.index) - bucket = data.aws_s3_bucket_objects.my_objects.bucket +data "aws_s3_object" "object_info" { + count = length(data.aws_s3_objects.my_objects.keys) + key = element(data.aws_s3_objects.my_objects.keys, count.index) + bucket = data.aws_s3_objects.my_objects.bucket } ``` From 37fd3b1f29ec13782dd57754b0496f3479280122 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Mon, 31 Jan 2022 12:19:13 -0500 Subject: [PATCH 06/17] docs: Update docs --- .../docs/r/cloudformation_type.html.markdown | 2 +- .../r/config_conformance_pack.html.markdown | 4 ++-- ...organization_conformance_pack.html.markdown | 4 ++-- ...beanstalk_application_version.html.markdown | 4 ++-- website/docs/r/gamelift_build.html.markdown | 2 +- website/docs/r/guardduty_ipset.html.markdown | 4 ++-- .../r/guardduty_threatintelset.html.markdown | 4 ++-- .../r/imagebuilder_component.html.markdown | 2 +- ...inesisanalyticsv2_application.html.markdown | 8 ++++---- website/docs/r/lambda_function.html.markdown | 2 +- .../docs/r/lambda_layer_version.html.markdown | 2 +- .../r/mskconnect_custom_plugin.html.markdown | 4 ++-- website/docs/r/s3_bucket_object.html.markdown | 18 +++++++++--------- ...catalog_provisioning_artifact.html.markdown | 2 +- 14 files changed, 31 insertions(+), 31 deletions(-) diff --git a/website/docs/r/cloudformation_type.html.markdown b/website/docs/r/cloudformation_type.html.markdown index b3819d49c16..c4dd058d23a 100644 --- a/website/docs/r/cloudformation_type.html.markdown +++ b/website/docs/r/cloudformation_type.html.markdown @@ -16,7 +16,7 @@ Manages a version of a CloudFormation Type. ```terraform resource "aws_cloudformation_type" "example" { - schema_handler_package = "s3://${aws_s3_bucket_object.example.bucket}/${aws_s3_bucket_object.example.key}" + schema_handler_package = "s3://${aws_s3_object.example.bucket}/${aws_s3_object.example.key}" type = "RESOURCE" type_name = "ExampleCompany::ExampleService::ExampleResource" diff --git a/website/docs/r/config_conformance_pack.html.markdown b/website/docs/r/config_conformance_pack.html.markdown index 3f135afec28..ac10f34fd48 100644 --- a/website/docs/r/config_conformance_pack.html.markdown +++ b/website/docs/r/config_conformance_pack.html.markdown @@ -53,7 +53,7 @@ EOT ```terraform resource "aws_config_conformance_pack" "example" { name = "example" - template_s3_uri = "s3://${aws_s3_bucket.example.bucket}/${aws_s3_bucket_object.example.key}" + template_s3_uri = "s3://${aws_s3_bucket.example.bucket}/${aws_s3_object.example.key}" depends_on = [aws_config_configuration_recorder.example] } @@ -62,7 +62,7 @@ resource "aws_s3_bucket" "example" { bucket = "example" } -resource "aws_s3_bucket_object" "example" { +resource "aws_s3_object" "example" { bucket = aws_s3_bucket.example.id key = "example-key" content = < Date: Mon, 31 Jan 2022 12:20:38 -0500 Subject: [PATCH 07/17] docs: Rename files --- .../d/{s3_bucket_object.html.markdown => s3_object.html.markdown} | 0 .../{s3_bucket_objects.html.markdown => s3_objects.html.markdown} | 0 .../r/{s3_bucket_object.html.markdown => s3_object.html.markdown} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename website/docs/d/{s3_bucket_object.html.markdown => s3_object.html.markdown} (100%) rename website/docs/d/{s3_bucket_objects.html.markdown => s3_objects.html.markdown} (100%) rename website/docs/r/{s3_bucket_object.html.markdown => s3_object.html.markdown} (100%) diff --git a/website/docs/d/s3_bucket_object.html.markdown b/website/docs/d/s3_object.html.markdown similarity index 100% rename from website/docs/d/s3_bucket_object.html.markdown rename to website/docs/d/s3_object.html.markdown diff --git a/website/docs/d/s3_bucket_objects.html.markdown b/website/docs/d/s3_objects.html.markdown similarity index 100% rename from website/docs/d/s3_bucket_objects.html.markdown rename to website/docs/d/s3_objects.html.markdown diff --git a/website/docs/r/s3_bucket_object.html.markdown b/website/docs/r/s3_object.html.markdown similarity index 100% rename from website/docs/r/s3_bucket_object.html.markdown rename to website/docs/r/s3_object.html.markdown From 02da776caba14aa8dac2400c4179a163e7dad470 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Mon, 31 Jan 2022 12:23:49 -0500 Subject: [PATCH 08/17] Rename files --- internal/service/s3/{bucket_object.go => object.go} | 0 .../s3/{bucket_object_data_source.go => object_data_source.go} | 0 ...cket_object_data_source_test.go => object_data_source_test.go} | 0 internal/service/s3/{bucket_object_test.go => object_test.go} | 0 .../s3/{bucket_objects_data_source.go => objects_data_source.go} | 0 ...et_objects_data_source_test.go => objects_data_source_test.go} | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename internal/service/s3/{bucket_object.go => object.go} (100%) rename internal/service/s3/{bucket_object_data_source.go => object_data_source.go} (100%) rename internal/service/s3/{bucket_object_data_source_test.go => object_data_source_test.go} (100%) rename internal/service/s3/{bucket_object_test.go => object_test.go} (100%) rename internal/service/s3/{bucket_objects_data_source.go => objects_data_source.go} (100%) rename internal/service/s3/{bucket_objects_data_source_test.go => objects_data_source_test.go} (100%) diff --git a/internal/service/s3/bucket_object.go b/internal/service/s3/object.go similarity index 100% rename from internal/service/s3/bucket_object.go rename to internal/service/s3/object.go diff --git a/internal/service/s3/bucket_object_data_source.go b/internal/service/s3/object_data_source.go similarity index 100% rename from internal/service/s3/bucket_object_data_source.go rename to internal/service/s3/object_data_source.go diff --git a/internal/service/s3/bucket_object_data_source_test.go b/internal/service/s3/object_data_source_test.go similarity index 100% rename from internal/service/s3/bucket_object_data_source_test.go rename to internal/service/s3/object_data_source_test.go diff --git a/internal/service/s3/bucket_object_test.go b/internal/service/s3/object_test.go similarity index 100% rename from internal/service/s3/bucket_object_test.go rename to internal/service/s3/object_test.go diff --git a/internal/service/s3/bucket_objects_data_source.go b/internal/service/s3/objects_data_source.go similarity index 100% rename from internal/service/s3/bucket_objects_data_source.go rename to internal/service/s3/objects_data_source.go diff --git a/internal/service/s3/bucket_objects_data_source_test.go b/internal/service/s3/objects_data_source_test.go similarity index 100% rename from internal/service/s3/bucket_objects_data_source_test.go rename to internal/service/s3/objects_data_source_test.go From 6b383171ac8a097e26764e510c03943f5a99d29d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Mon, 31 Jan 2022 12:26:54 -0500 Subject: [PATCH 09/17] Update messages --- internal/service/s3/object.go | 4 ++-- website/docs/r/cloudtrail.html.markdown | 2 +- .../docs/r/s3_bucket_analytics_configuration.html.markdown | 2 +- .../s3_bucket_intelligent_tiering_configuration.html.markdown | 2 +- website/docs/r/s3_bucket_inventory.html.markdown | 2 +- website/docs/r/s3_bucket_metric.html.markdown | 2 +- website/docs/r/s3_object.html.markdown | 4 ++-- website/docs/r/storagegateway_nfs_file_share.html.markdown | 2 +- website/docs/r/storagegateway_smb_file_share.html.markdown | 2 +- 9 files changed, 11 insertions(+), 11 deletions(-) diff --git a/internal/service/s3/object.go b/internal/service/s3/object.go index 8dca8fc1625..47ed737d709 100644 --- a/internal/service/s3/object.go +++ b/internal/service/s3/object.go @@ -434,14 +434,14 @@ func resourceBucketObjectUpload(d *schema.ResourceData, meta interface{}) error } file, err := os.Open(path) if err != nil { - return fmt.Errorf("Error opening S3 bucket object source (%s): %s", path, err) + return fmt.Errorf("Error opening S3 object source (%s): %s", path, err) } body = file defer func() { err := file.Close() if err != nil { - log.Printf("[WARN] Error closing S3 bucket object source (%s): %s", path, err) + log.Printf("[WARN] Error closing S3 object source (%s): %s", path, err) } }() } else if v, ok := d.GetOk("content"); ok { diff --git a/website/docs/r/cloudtrail.html.markdown b/website/docs/r/cloudtrail.html.markdown index b9f861a5083..ef5b5a5ddd6 100644 --- a/website/docs/r/cloudtrail.html.markdown +++ b/website/docs/r/cloudtrail.html.markdown @@ -70,7 +70,7 @@ POLICY ### Data Event Logging -CloudTrail can log [Data Events](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-data-events-with-cloudtrail.html) for certain services such as S3 bucket objects and Lambda function invocations. Additional information about data event configuration can be found in the following links: +CloudTrail can log [Data Events](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-data-events-with-cloudtrail.html) for certain services such as S3 objects and Lambda function invocations. Additional information about data event configuration can be found in the following links: * [CloudTrail API DataResource documentation](https://docs.aws.amazon.com/awscloudtrail/latest/APIReference/API_DataResource.html) (for basic event selector). * [CloudTrail API AdvancedFieldSelector documentation](https://docs.aws.amazon.com/awscloudtrail/latest/APIReference/API_AdvancedFieldSelector.html) (for advanced event selector). diff --git a/website/docs/r/s3_bucket_analytics_configuration.html.markdown b/website/docs/r/s3_bucket_analytics_configuration.html.markdown index f847db50611..af45c545027 100644 --- a/website/docs/r/s3_bucket_analytics_configuration.html.markdown +++ b/website/docs/r/s3_bucket_analytics_configuration.html.markdown @@ -39,7 +39,7 @@ resource "aws_s3_bucket" "analytics" { } ``` -### Add analytics configuration with S3 bucket object filter +### Add analytics configuration with S3 object filter ```terraform resource "aws_s3_bucket_analytics_configuration" "example-filtered" { diff --git a/website/docs/r/s3_bucket_intelligent_tiering_configuration.html.markdown b/website/docs/r/s3_bucket_intelligent_tiering_configuration.html.markdown index 7d16efd69c9..844dee3876f 100644 --- a/website/docs/r/s3_bucket_intelligent_tiering_configuration.html.markdown +++ b/website/docs/r/s3_bucket_intelligent_tiering_configuration.html.markdown @@ -34,7 +34,7 @@ resource "aws_s3_bucket" "example" { } ``` -### Add intelligent tiering configuration with S3 bucket object filter +### Add intelligent tiering configuration with S3 object filter ```terraform resource "aws_s3_bucket_intelligent_tiering_configuration" "example-filtered" { diff --git a/website/docs/r/s3_bucket_inventory.html.markdown b/website/docs/r/s3_bucket_inventory.html.markdown index 3f79ce72aed..1a5f806ab66 100644 --- a/website/docs/r/s3_bucket_inventory.html.markdown +++ b/website/docs/r/s3_bucket_inventory.html.markdown @@ -42,7 +42,7 @@ resource "aws_s3_bucket_inventory" "test" { } ``` -### Add inventory configuration with S3 bucket object prefix +### Add inventory configuration with S3 object prefix ```terraform resource "aws_s3_bucket" "test" { diff --git a/website/docs/r/s3_bucket_metric.html.markdown b/website/docs/r/s3_bucket_metric.html.markdown index 65aee084f0a..64d363c80e2 100644 --- a/website/docs/r/s3_bucket_metric.html.markdown +++ b/website/docs/r/s3_bucket_metric.html.markdown @@ -25,7 +25,7 @@ resource "aws_s3_bucket_metric" "example-entire-bucket" { } ``` -### Add metrics configuration with S3 bucket object filter +### Add metrics configuration with S3 object filter ```terraform resource "aws_s3_bucket" "example" { diff --git a/website/docs/r/s3_object.html.markdown b/website/docs/r/s3_object.html.markdown index 2e4762fc8ee..d690538279d 100644 --- a/website/docs/r/s3_object.html.markdown +++ b/website/docs/r/s3_object.html.markdown @@ -3,12 +3,12 @@ subcategory: "S3" layout: "aws" page_title: "AWS: aws_s3_object" description: |- - Provides a S3 bucket object resource. + Provides an S3 object resource. --- # Resource: aws_s3_object -Provides a S3 bucket object resource. +Provides an S3 object resource. ## Example Usage diff --git a/website/docs/r/storagegateway_nfs_file_share.html.markdown b/website/docs/r/storagegateway_nfs_file_share.html.markdown index ef3083836db..5e9cb2d474f 100644 --- a/website/docs/r/storagegateway_nfs_file_share.html.markdown +++ b/website/docs/r/storagegateway_nfs_file_share.html.markdown @@ -36,7 +36,7 @@ The following arguments are supported: * `kms_key_arn` - (Optional) Amazon Resource Name (ARN) for KMS key used for Amazon S3 server side encryption. This value can only be set when `kms_encrypted` is true. * `nfs_file_share_defaults` - (Optional) Nested argument with file share default values. More information below. see [NFS File Share Defaults](#nfs_file_share_defaults) for more details. * `cache_attributes` - (Optional) Refresh cache information. see [Cache Attributes](#cache_attributes) for more details. -* `object_acl` - (Optional) Access Control List permission for S3 bucket objects. Defaults to `private`. +* `object_acl` - (Optional) Access Control List permission for S3 objects. Defaults to `private`. * `read_only` - (Optional) Boolean to indicate write status of file share. File share does not accept writes if `true`. Defaults to `false`. * `requester_pays` - (Optional) Boolean who pays the cost of the request and the data download from the Amazon S3 bucket. Set this value to `true` if you want the requester to pay instead of the bucket owner. Defaults to `false`. * `squash` - (Optional) Maps a user to anonymous user. Defaults to `RootSquash`. Valid values: `RootSquash` (only root is mapped to anonymous user), `NoSquash` (no one is mapped to anonymous user), `AllSquash` (everyone is mapped to anonymous user) diff --git a/website/docs/r/storagegateway_smb_file_share.html.markdown b/website/docs/r/storagegateway_smb_file_share.html.markdown index e235f442230..223f9c1812e 100644 --- a/website/docs/r/storagegateway_smb_file_share.html.markdown +++ b/website/docs/r/storagegateway_smb_file_share.html.markdown @@ -56,7 +56,7 @@ The following arguments are supported: * `invalid_user_list` - (Optional) A list of users in the Active Directory that are not allowed to access the file share. Only valid if `authentication` is set to `ActiveDirectory`. * `kms_encrypted` - (Optional) Boolean value if `true` to use Amazon S3 server side encryption with your own AWS KMS key, or `false` to use a key managed by Amazon S3. Defaults to `false`. * `kms_key_arn` - (Optional) Amazon Resource Name (ARN) for KMS key used for Amazon S3 server side encryption. This value can only be set when `kms_encrypted` is true. -* `object_acl` - (Optional) Access Control List permission for S3 bucket objects. Defaults to `private`. +* `object_acl` - (Optional) Access Control List permission for S3 objects. Defaults to `private`. * `oplocks_enabled` - (Optional) Boolean to indicate Opportunistic lock (oplock) status. Defaults to `true`. * `cache_attributes` - (Optional) Refresh cache information. see [Cache Attributes](#cache_attributes) for more details. * `read_only` - (Optional) Boolean to indicate write status of file share. File share does not accept writes if `true`. Defaults to `false`. From 8a10a54ece432664fee8388de9564dcdf6989a4b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Mon, 31 Jan 2022 12:29:15 -0500 Subject: [PATCH 10/17] Update messages --- internal/service/s3/bucket.go | 2 +- internal/service/s3/object.go | 2 +- internal/service/s3/object_copy.go | 2 +- internal/service/s3/object_copy_test.go | 2 +- internal/service/s3/object_data_source.go | 2 +- internal/service/s3/object_test.go | 2 +- internal/service/s3/sweep.go | 6 +++--- website/docs/r/cloudtrail.html.markdown | 4 ++-- website/docs/r/dms_endpoint.html.markdown | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/service/s3/bucket.go b/internal/service/s3/bucket.go index 1d538674c2d..22fe3f8119c 100644 --- a/internal/service/s3/bucket.go +++ b/internal/service/s3/bucket.go @@ -1308,7 +1308,7 @@ func resourceBucketRead(d *schema.ResourceData, meta interface{}) error { // Object lock not supported in all partitions (extra guard, also guards in read func) if err != nil && (meta.(*conns.AWSClient).Partition == endpoints.AwsPartitionID || meta.(*conns.AWSClient).Partition == endpoints.AwsUsGovPartitionID) { - return fmt.Errorf("error getting S3 Bucket Object Lock configuration: %s", err) + return fmt.Errorf("error getting S3 Object Lock configuration: %s", err) } if err != nil { diff --git a/internal/service/s3/object.go b/internal/service/s3/object.go index 47ed737d709..dfb0666d945 100644 --- a/internal/service/s3/object.go +++ b/internal/service/s3/object.go @@ -235,7 +235,7 @@ func resourceBucketObjectRead(d *schema.ResourceData, meta interface{}) error { return fmt.Errorf("error reading S3 Object (%s): %w", d.Id(), err) } - log.Printf("[DEBUG] Reading S3 Bucket Object meta: %s", resp) + log.Printf("[DEBUG] Reading S3 Object meta: %s", resp) d.Set("bucket_key_enabled", resp.BucketKeyEnabled) d.Set("cache_control", resp.CacheControl) diff --git a/internal/service/s3/object_copy.go b/internal/service/s3/object_copy.go index 5db14b97e91..829c1d14ee9 100644 --- a/internal/service/s3/object_copy.go +++ b/internal/service/s3/object_copy.go @@ -323,7 +323,7 @@ func resourceObjectCopyRead(d *schema.ResourceData, meta interface{}) error { return fmt.Errorf("error reading S3 Object (%s): empty response", d.Id()) } - log.Printf("[DEBUG] Reading S3 Bucket Object meta: %s", resp) + log.Printf("[DEBUG] Reading S3 Object meta: %s", resp) d.Set("bucket_key_enabled", resp.BucketKeyEnabled) d.Set("cache_control", resp.CacheControl) diff --git a/internal/service/s3/object_copy_test.go b/internal/service/s3/object_copy_test.go index ecfb04d0e59..5b70b17f5cb 100644 --- a/internal/service/s3/object_copy_test.go +++ b/internal/service/s3/object_copy_test.go @@ -112,7 +112,7 @@ func testAccCheckObjectCopyExists(n string) resource.TestCheckFunc { } if rs.Primary.ID == "" { - return fmt.Errorf("No S3 Bucket Object ID is set") + return fmt.Errorf("No S3 Object ID is set") } conn := acctest.Provider.Meta().(*conns.AWSClient).S3Conn diff --git a/internal/service/s3/object_data_source.go b/internal/service/s3/object_data_source.go index 0f548d308ca..68d424b2c98 100644 --- a/internal/service/s3/object_data_source.go +++ b/internal/service/s3/object_data_source.go @@ -150,7 +150,7 @@ func dataSourceBucketObjectRead(d *schema.ResourceData, meta interface{}) error uniqueId += "@" + v.(string) } - log.Printf("[DEBUG] Reading S3 Bucket Object: %s", input) + log.Printf("[DEBUG] Reading S3 Object: %s", input) out, err := conn.HeadObject(&input) if err != nil { return fmt.Errorf("failed getting S3 Bucket (%s) Object (%s): %w", bucket, key, err) diff --git a/internal/service/s3/object_test.go b/internal/service/s3/object_test.go index 86ac712fdbe..b53a61b18a2 100644 --- a/internal/service/s3/object_test.go +++ b/internal/service/s3/object_test.go @@ -1371,7 +1371,7 @@ func testAccCheckBucketObjectExists(n string, obj *s3.GetObjectOutput) resource. } if rs.Primary.ID == "" { - return fmt.Errorf("No S3 Bucket Object ID is set") + return fmt.Errorf("No S3 Object ID is set") } conn := acctest.Provider.Meta().(*conns.AWSClient).S3Conn diff --git a/internal/service/s3/sweep.go b/internal/service/s3/sweep.go index 7ba3b87f31b..a0d255169c2 100644 --- a/internal/service/s3/sweep.go +++ b/internal/service/s3/sweep.go @@ -50,16 +50,16 @@ func sweepBucketObjects(region string) error { output, err := conn.ListBuckets(input) if sweep.SkipSweepError(err) { - log.Printf("[WARN] Skipping S3 Bucket Objects sweep for %s: %s", region, err) + log.Printf("[WARN] Skipping S3 Objects sweep for %s: %s", region, err) return nil } if err != nil { - return fmt.Errorf("error listing S3 Bucket Objects: %s", err) + return fmt.Errorf("error listing S3 Objects: %s", err) } if len(output.Buckets) == 0 { - log.Print("[DEBUG] No S3 Bucket Objects to sweep") + log.Print("[DEBUG] No S3 Objects to sweep") return nil } diff --git a/website/docs/r/cloudtrail.html.markdown b/website/docs/r/cloudtrail.html.markdown index ef5b5a5ddd6..279b5155578 100644 --- a/website/docs/r/cloudtrail.html.markdown +++ b/website/docs/r/cloudtrail.html.markdown @@ -93,7 +93,7 @@ resource "aws_cloudtrail" "example" { } ``` -#### Logging All S3 Bucket Object Events By Using Basic Event Selectors +#### Logging All S3 Object Events By Using Basic Event Selectors ```terraform resource "aws_cloudtrail" "example" { @@ -136,7 +136,7 @@ resource "aws_cloudtrail" "example" { } ``` -#### Logging All S3 Bucket Object Events Except For Two S3 Buckets By Using Advanced Event Selectors +#### Logging All S3 Object Events Except For Two S3 Buckets By Using Advanced Event Selectors ```terraform data "aws_s3_bucket" "not-important-bucket-1" { diff --git a/website/docs/r/dms_endpoint.html.markdown b/website/docs/r/dms_endpoint.html.markdown index 5309b4eb969..dd0b04e9c78 100644 --- a/website/docs/r/dms_endpoint.html.markdown +++ b/website/docs/r/dms_endpoint.html.markdown @@ -142,7 +142,7 @@ The `mongodb_settings` configuration block supports the following arguments: The `s3_settings` configuration block supports the following arguments: -* `bucket_folder` - (Optional) S3 Bucket Object prefix. +* `bucket_folder` - (Optional) S3 Object prefix. * `bucket_name` - (Optional) S3 Bucket name. * `compression_type` - (Optional) Set to compress target files. Defaults to `NONE`. Valid values are `GZIP` and `NONE`. * `csv_delimiter` - (Optional) Delimiter used to separate columns in the source files. Defaults to `,`. From 9e62fa79bdeeab766e8f324445e12fd8965a3dfe Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Mon, 31 Jan 2022 12:32:02 -0500 Subject: [PATCH 11/17] Change names --- internal/service/s3/object.go | 6 +- internal/service/s3/object_copy_test.go | 2 +- .../service/s3/object_data_source_test.go | 22 +++---- internal/service/s3/object_test.go | 62 +++++++++---------- .../service/s3/objects_data_source_test.go | 16 ++--- 5 files changed, 54 insertions(+), 54 deletions(-) diff --git a/internal/service/s3/object.go b/internal/service/s3/object.go index dfb0666d945..741c6acbcdb 100644 --- a/internal/service/s3/object.go +++ b/internal/service/s3/object.go @@ -305,7 +305,7 @@ func resourceBucketObjectRead(d *schema.ResourceData, meta interface{}) error { } func resourceBucketObjectUpdate(d *schema.ResourceData, meta interface{}) error { - if hasS3BucketObjectContentChanges(d) { + if hasS3ObjectContentChanges(d) { return resourceBucketObjectUpload(d, meta) } @@ -573,7 +573,7 @@ func validateMetadataIsLowerCase(v interface{}, k string) (ws []string, errors [ } func resourceBucketObjectCustomizeDiff(_ context.Context, d *schema.ResourceDiff, meta interface{}) error { - if hasS3BucketObjectContentChanges(d) { + if hasS3ObjectContentChanges(d) { return d.SetNewComputed("version_id") } @@ -585,7 +585,7 @@ func resourceBucketObjectCustomizeDiff(_ context.Context, d *schema.ResourceDiff return nil } -func hasS3BucketObjectContentChanges(d verify.ResourceDiffer) bool { +func hasS3ObjectContentChanges(d verify.ResourceDiffer) bool { for _, key := range []string{ "bucket_key_enabled", "cache_control", diff --git a/internal/service/s3/object_copy_test.go b/internal/service/s3/object_copy_test.go index 5b70b17f5cb..5b17a595870 100644 --- a/internal/service/s3/object_copy_test.go +++ b/internal/service/s3/object_copy_test.go @@ -123,7 +123,7 @@ func testAccCheckObjectCopyExists(n string) resource.TestCheckFunc { IfMatch: aws.String(rs.Primary.Attributes["etag"]), }) if err != nil { - return fmt.Errorf("S3Bucket Object error: %s", err) + return fmt.Errorf("S3 Object error: %s", err) } return nil diff --git a/internal/service/s3/object_data_source_test.go b/internal/service/s3/object_data_source_test.go index 85e596a7e19..3570a81a72e 100644 --- a/internal/service/s3/object_data_source_test.go +++ b/internal/service/s3/object_data_source_test.go @@ -17,7 +17,7 @@ import ( const rfc1123RegexPattern = `^[a-zA-Z]{3}, [0-9]+ [a-zA-Z]+ [0-9]{4} [0-9:]+ [A-Z]+$` -func TestAccS3BucketObjectDataSource_basic(t *testing.T) { +func TestAccS3ObjectDataSource_basic(t *testing.T) { rInt := sdkacctest.RandInt() var rObj s3.GetObjectOutput @@ -51,7 +51,7 @@ func TestAccS3BucketObjectDataSource_basic(t *testing.T) { }) } -func TestAccS3BucketObjectDataSource_basicViaAccessPoint(t *testing.T) { +func TestAccS3ObjectDataSource_basicViaAccessPoint(t *testing.T) { var dsObj, rObj s3.GetObjectOutput rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -78,7 +78,7 @@ func TestAccS3BucketObjectDataSource_basicViaAccessPoint(t *testing.T) { }) } -func TestAccS3BucketObjectDataSource_readableBody(t *testing.T) { +func TestAccS3ObjectDataSource_readableBody(t *testing.T) { rInt := sdkacctest.RandInt() var rObj s3.GetObjectOutput @@ -112,7 +112,7 @@ func TestAccS3BucketObjectDataSource_readableBody(t *testing.T) { }) } -func TestAccS3BucketObjectDataSource_kmsEncrypted(t *testing.T) { +func TestAccS3ObjectDataSource_kmsEncrypted(t *testing.T) { rInt := sdkacctest.RandInt() var rObj s3.GetObjectOutput @@ -148,7 +148,7 @@ func TestAccS3BucketObjectDataSource_kmsEncrypted(t *testing.T) { }) } -func TestAccS3BucketObjectDataSource_bucketKeyEnabled(t *testing.T) { +func TestAccS3ObjectDataSource_bucketKeyEnabled(t *testing.T) { rInt := sdkacctest.RandInt() var rObj s3.GetObjectOutput @@ -185,7 +185,7 @@ func TestAccS3BucketObjectDataSource_bucketKeyEnabled(t *testing.T) { }) } -func TestAccS3BucketObjectDataSource_allParams(t *testing.T) { +func TestAccS3ObjectDataSource_allParams(t *testing.T) { rInt := sdkacctest.RandInt() var rObj s3.GetObjectOutput @@ -236,7 +236,7 @@ func TestAccS3BucketObjectDataSource_allParams(t *testing.T) { }) } -func TestAccS3BucketObjectDataSource_objectLockLegalHoldOff(t *testing.T) { +func TestAccS3ObjectDataSource_objectLockLegalHoldOff(t *testing.T) { rInt := sdkacctest.RandInt() var rObj s3.GetObjectOutput @@ -270,7 +270,7 @@ func TestAccS3BucketObjectDataSource_objectLockLegalHoldOff(t *testing.T) { }) } -func TestAccS3BucketObjectDataSource_objectLockLegalHoldOn(t *testing.T) { +func TestAccS3ObjectDataSource_objectLockLegalHoldOn(t *testing.T) { rInt := sdkacctest.RandInt() retainUntilDate := time.Now().UTC().AddDate(0, 0, 10).Format(time.RFC3339) @@ -305,7 +305,7 @@ func TestAccS3BucketObjectDataSource_objectLockLegalHoldOn(t *testing.T) { }) } -func TestAccS3BucketObjectDataSource_leadingSlash(t *testing.T) { +func TestAccS3ObjectDataSource_leadingSlash(t *testing.T) { var rObj s3.GetObjectOutput var dsObj1, dsObj2, dsObj3 s3.GetObjectOutput @@ -358,7 +358,7 @@ func TestAccS3BucketObjectDataSource_leadingSlash(t *testing.T) { }) } -func TestAccS3BucketObjectDataSource_multipleSlashes(t *testing.T) { +func TestAccS3ObjectDataSource_multipleSlashes(t *testing.T) { var rObj1, rObj2 s3.GetObjectOutput var dsObj1, dsObj2, dsObj3 s3.GetObjectOutput @@ -408,7 +408,7 @@ func TestAccS3BucketObjectDataSource_multipleSlashes(t *testing.T) { }) } -func TestAccS3BucketObjectDataSource_singleSlashAsKey(t *testing.T) { +func TestAccS3ObjectDataSource_singleSlashAsKey(t *testing.T) { var dsObj s3.GetObjectOutput dataSourceName := "data.aws_s3_object.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) diff --git a/internal/service/s3/object_test.go b/internal/service/s3/object_test.go index b53a61b18a2..69f53a90354 100644 --- a/internal/service/s3/object_test.go +++ b/internal/service/s3/object_test.go @@ -25,7 +25,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/tfresource" ) -func TestAccS3BucketObject_noNameNoKey(t *testing.T) { +func TestAccS3Object_noNameNoKey(t *testing.T) { bucketError := regexp.MustCompile(`bucket must not be empty`) keyError := regexp.MustCompile(`key must not be empty`) @@ -49,7 +49,7 @@ func TestAccS3BucketObject_noNameNoKey(t *testing.T) { }) } -func TestAccS3BucketObject_empty(t *testing.T) { +func TestAccS3Object_empty(t *testing.T) { var obj s3.GetObjectOutput resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -79,7 +79,7 @@ func TestAccS3BucketObject_empty(t *testing.T) { }) } -func TestAccS3BucketObject_source(t *testing.T) { +func TestAccS3Object_source(t *testing.T) { var obj s3.GetObjectOutput resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -111,7 +111,7 @@ func TestAccS3BucketObject_source(t *testing.T) { }) } -func TestAccS3BucketObject_content(t *testing.T) { +func TestAccS3Object_content(t *testing.T) { var obj s3.GetObjectOutput resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -141,7 +141,7 @@ func TestAccS3BucketObject_content(t *testing.T) { }) } -func TestAccS3BucketObject_etagEncryption(t *testing.T) { +func TestAccS3Object_etagEncryption(t *testing.T) { var obj s3.GetObjectOutput resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -174,7 +174,7 @@ func TestAccS3BucketObject_etagEncryption(t *testing.T) { }) } -func TestAccS3BucketObject_contentBase64(t *testing.T) { +func TestAccS3Object_contentBase64(t *testing.T) { var obj s3.GetObjectOutput resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -197,7 +197,7 @@ func TestAccS3BucketObject_contentBase64(t *testing.T) { }) } -func TestAccS3BucketObject_sourceHashTrigger(t *testing.T) { +func TestAccS3Object_sourceHashTrigger(t *testing.T) { var obj, updated_obj s3.GetObjectOutput resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -253,7 +253,7 @@ func TestAccS3BucketObject_sourceHashTrigger(t *testing.T) { }) } -func TestAccS3BucketObject_withContentCharacteristics(t *testing.T) { +func TestAccS3Object_withContentCharacteristics(t *testing.T) { var obj s3.GetObjectOutput resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -280,7 +280,7 @@ func TestAccS3BucketObject_withContentCharacteristics(t *testing.T) { }) } -func TestAccS3BucketObject_nonVersioned(t *testing.T) { +func TestAccS3Object_nonVersioned(t *testing.T) { sourceInitial := testAccBucketObjectCreateTempFile(t, "initial object state") defer os.Remove(sourceInitial) rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -312,7 +312,7 @@ func TestAccS3BucketObject_nonVersioned(t *testing.T) { }) } -func TestAccS3BucketObject_updates(t *testing.T) { +func TestAccS3Object_updates(t *testing.T) { var originalObj, modifiedObj s3.GetObjectOutput resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -361,7 +361,7 @@ func TestAccS3BucketObject_updates(t *testing.T) { }) } -func TestAccS3BucketObject_updateSameFile(t *testing.T) { +func TestAccS3Object_updateSameFile(t *testing.T) { var originalObj, modifiedObj s3.GetObjectOutput resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -408,7 +408,7 @@ func TestAccS3BucketObject_updateSameFile(t *testing.T) { }) } -func TestAccS3BucketObject_updatesWithVersioning(t *testing.T) { +func TestAccS3Object_updatesWithVersioning(t *testing.T) { var originalObj, modifiedObj s3.GetObjectOutput resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -452,7 +452,7 @@ func TestAccS3BucketObject_updatesWithVersioning(t *testing.T) { }) } -func TestAccS3BucketObject_updatesWithVersioningViaAccessPoint(t *testing.T) { +func TestAccS3Object_updatesWithVersioningViaAccessPoint(t *testing.T) { var originalObj, modifiedObj s3.GetObjectOutput rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object.test" @@ -491,7 +491,7 @@ func TestAccS3BucketObject_updatesWithVersioningViaAccessPoint(t *testing.T) { }) } -func TestAccS3BucketObject_kms(t *testing.T) { +func TestAccS3Object_kms(t *testing.T) { var obj s3.GetObjectOutput resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -525,7 +525,7 @@ func TestAccS3BucketObject_kms(t *testing.T) { }) } -func TestAccS3BucketObject_sse(t *testing.T) { +func TestAccS3Object_sse(t *testing.T) { var obj s3.GetObjectOutput resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -559,7 +559,7 @@ func TestAccS3BucketObject_sse(t *testing.T) { }) } -func TestAccS3BucketObject_acl(t *testing.T) { +func TestAccS3Object_acl(t *testing.T) { var obj1, obj2, obj3 s3.GetObjectOutput resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -610,7 +610,7 @@ func TestAccS3BucketObject_acl(t *testing.T) { }) } -func TestAccS3BucketObject_metadata(t *testing.T) { +func TestAccS3Object_metadata(t *testing.T) { rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) var obj s3.GetObjectOutput resourceName := "aws_s3_object.object" @@ -657,7 +657,7 @@ func TestAccS3BucketObject_metadata(t *testing.T) { }) } -func TestAccS3BucketObject_storageClass(t *testing.T) { +func TestAccS3Object_storageClass(t *testing.T) { var obj s3.GetObjectOutput resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -720,7 +720,7 @@ func TestAccS3BucketObject_storageClass(t *testing.T) { }) } -func TestAccS3BucketObject_tags(t *testing.T) { +func TestAccS3Object_tags(t *testing.T) { var obj1, obj2, obj3, obj4 s3.GetObjectOutput rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object.object" @@ -792,7 +792,7 @@ func TestAccS3BucketObject_tags(t *testing.T) { }) } -func TestAccS3BucketObject_tagsLeadingSingleSlash(t *testing.T) { +func TestAccS3Object_tagsLeadingSingleSlash(t *testing.T) { var obj1, obj2, obj3, obj4 s3.GetObjectOutput rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object.object" @@ -864,7 +864,7 @@ func TestAccS3BucketObject_tagsLeadingSingleSlash(t *testing.T) { }) } -func TestAccS3BucketObject_tagsLeadingMultipleSlashes(t *testing.T) { +func TestAccS3Object_tagsLeadingMultipleSlashes(t *testing.T) { var obj1, obj2, obj3, obj4 s3.GetObjectOutput rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object.object" @@ -929,7 +929,7 @@ func TestAccS3BucketObject_tagsLeadingMultipleSlashes(t *testing.T) { }) } -func TestAccS3BucketObject_tagsMultipleSlashes(t *testing.T) { +func TestAccS3Object_tagsMultipleSlashes(t *testing.T) { var obj1, obj2, obj3, obj4 s3.GetObjectOutput rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object.object" @@ -994,7 +994,7 @@ func TestAccS3BucketObject_tagsMultipleSlashes(t *testing.T) { }) } -func TestAccS3BucketObject_objectLockLegalHoldStartWithNone(t *testing.T) { +func TestAccS3Object_objectLockLegalHoldStartWithNone(t *testing.T) { var obj1, obj2, obj3 s3.GetObjectOutput resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -1042,7 +1042,7 @@ func TestAccS3BucketObject_objectLockLegalHoldStartWithNone(t *testing.T) { }) } -func TestAccS3BucketObject_objectLockLegalHoldStartWithOn(t *testing.T) { +func TestAccS3Object_objectLockLegalHoldStartWithOn(t *testing.T) { var obj1, obj2 s3.GetObjectOutput resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -1078,7 +1078,7 @@ func TestAccS3BucketObject_objectLockLegalHoldStartWithOn(t *testing.T) { }) } -func TestAccS3BucketObject_objectLockRetentionStartWithNone(t *testing.T) { +func TestAccS3Object_objectLockRetentionStartWithNone(t *testing.T) { var obj1, obj2, obj3 s3.GetObjectOutput resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -1127,7 +1127,7 @@ func TestAccS3BucketObject_objectLockRetentionStartWithNone(t *testing.T) { }) } -func TestAccS3BucketObject_objectLockRetentionStartWithSet(t *testing.T) { +func TestAccS3Object_objectLockRetentionStartWithSet(t *testing.T) { var obj1, obj2, obj3, obj4 s3.GetObjectOutput resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -1188,7 +1188,7 @@ func TestAccS3BucketObject_objectLockRetentionStartWithSet(t *testing.T) { }) } -func TestAccS3BucketObject_objectBucketKeyEnabled(t *testing.T) { +func TestAccS3Object_objectBucketKeyEnabled(t *testing.T) { var obj s3.GetObjectOutput resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -1211,7 +1211,7 @@ func TestAccS3BucketObject_objectBucketKeyEnabled(t *testing.T) { }) } -func TestAccS3BucketObject_bucketBucketKeyEnabled(t *testing.T) { +func TestAccS3Object_bucketBucketKeyEnabled(t *testing.T) { var obj s3.GetObjectOutput resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -1234,7 +1234,7 @@ func TestAccS3BucketObject_bucketBucketKeyEnabled(t *testing.T) { }) } -func TestAccS3BucketObject_defaultBucketSSE(t *testing.T) { +func TestAccS3Object_defaultBucketSSE(t *testing.T) { var obj1 s3.GetObjectOutput resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -1256,7 +1256,7 @@ func TestAccS3BucketObject_defaultBucketSSE(t *testing.T) { }) } -func TestAccS3BucketObject_ignoreTags(t *testing.T) { +func TestAccS3Object_ignoreTags(t *testing.T) { var obj s3.GetObjectOutput rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_s3_object.object" @@ -1405,7 +1405,7 @@ func testAccCheckBucketObjectExists(n string, obj *s3.GetObjectOutput) resource. } if err != nil { - return fmt.Errorf("S3Bucket Object error: %s", err) + return fmt.Errorf("S3 Object error: %s", err) } *obj = *out diff --git a/internal/service/s3/objects_data_source_test.go b/internal/service/s3/objects_data_source_test.go index 8c13beaa912..9d90aca9bd9 100644 --- a/internal/service/s3/objects_data_source_test.go +++ b/internal/service/s3/objects_data_source_test.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/acctest" ) -func TestAccS3BucketObjectsDataSource_basic(t *testing.T) { +func TestAccS3ObjectsDataSource_basic(t *testing.T) { rInt := sdkacctest.RandInt() resource.ParallelTest(t, resource.TestCase{ @@ -37,7 +37,7 @@ func TestAccS3BucketObjectsDataSource_basic(t *testing.T) { }) } -func TestAccS3BucketObjectsDataSource_basicViaAccessPoint(t *testing.T) { +func TestAccS3ObjectsDataSource_basicViaAccessPoint(t *testing.T) { rInt := sdkacctest.RandInt() resource.ParallelTest(t, resource.TestCase{ @@ -63,7 +63,7 @@ func TestAccS3BucketObjectsDataSource_basicViaAccessPoint(t *testing.T) { }) } -func TestAccS3BucketObjectsDataSource_all(t *testing.T) { +func TestAccS3ObjectsDataSource_all(t *testing.T) { rInt := sdkacctest.RandInt() resource.ParallelTest(t, resource.TestCase{ @@ -94,7 +94,7 @@ func TestAccS3BucketObjectsDataSource_all(t *testing.T) { }) } -func TestAccS3BucketObjectsDataSource_prefixes(t *testing.T) { +func TestAccS3ObjectsDataSource_prefixes(t *testing.T) { rInt := sdkacctest.RandInt() resource.ParallelTest(t, resource.TestCase{ @@ -124,7 +124,7 @@ func TestAccS3BucketObjectsDataSource_prefixes(t *testing.T) { }) } -func TestAccS3BucketObjectsDataSource_encoded(t *testing.T) { +func TestAccS3ObjectsDataSource_encoded(t *testing.T) { rInt := sdkacctest.RandInt() resource.ParallelTest(t, resource.TestCase{ @@ -150,7 +150,7 @@ func TestAccS3BucketObjectsDataSource_encoded(t *testing.T) { }) } -func TestAccS3BucketObjectsDataSource_maxKeys(t *testing.T) { +func TestAccS3ObjectsDataSource_maxKeys(t *testing.T) { rInt := sdkacctest.RandInt() resource.ParallelTest(t, resource.TestCase{ @@ -176,7 +176,7 @@ func TestAccS3BucketObjectsDataSource_maxKeys(t *testing.T) { }) } -func TestAccS3BucketObjectsDataSource_startAfter(t *testing.T) { +func TestAccS3ObjectsDataSource_startAfter(t *testing.T) { rInt := sdkacctest.RandInt() resource.ParallelTest(t, resource.TestCase{ @@ -201,7 +201,7 @@ func TestAccS3BucketObjectsDataSource_startAfter(t *testing.T) { }) } -func TestAccS3BucketObjectsDataSource_fetchOwner(t *testing.T) { +func TestAccS3ObjectsDataSource_fetchOwner(t *testing.T) { rInt := sdkacctest.RandInt() resource.ParallelTest(t, resource.TestCase{ From 814bd059cf11aa33698fb6bf6f44cec399ad2c1c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Mon, 31 Jan 2022 12:36:58 -0500 Subject: [PATCH 12/17] Update functions, consts, etc --- internal/provider/provider.go | 2 +- .../service/apigateway/domain_name_test.go | 4 +- .../service/apigatewayv2/domain_name_test.go | 6 +- .../service/ec2/ebs_snapshot_import_test.go | 4 +- .../kinesisanalyticsv2/application_test.go | 98 +++++++++---------- internal/service/mwaa/environment_test.go | 6 +- internal/service/s3/bucket.go | 4 +- internal/service/s3/object.go | 44 ++++----- internal/service/s3/object_copy.go | 4 +- 9 files changed, 86 insertions(+), 86 deletions(-) diff --git a/internal/provider/provider.go b/internal/provider/provider.go index 871357a9d74..cfbbb7236d8 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -1593,12 +1593,12 @@ func Provider() *schema.Provider { "aws_s3_bucket_inventory": s3.ResourceBucketInventory(), "aws_s3_bucket_metric": s3.ResourceBucketMetric(), "aws_s3_bucket_notification": s3.ResourceBucketNotification(), - "aws_s3_object": s3.ResourceBucketObject(), "aws_s3_bucket_ownership_controls": s3.ResourceBucketOwnershipControls(), "aws_s3_bucket_policy": s3.ResourceBucketPolicy(), "aws_s3_bucket_public_access_block": s3.ResourceBucketPublicAccessBlock(), "aws_s3_bucket_replication_configuration": s3.ResourceBucketReplicationConfiguration(), "aws_s3_bucket_versioning": s3.ResourceBucketVersioning(), + "aws_s3_object": s3.ResourceObject(), "aws_s3_object_copy": s3.ResourceObjectCopy(), "aws_s3_access_point": s3control.ResourceAccessPoint(), diff --git a/internal/service/apigateway/domain_name_test.go b/internal/service/apigateway/domain_name_test.go index 56178ef56da..8534ded436e 100644 --- a/internal/service/apigateway/domain_name_test.go +++ b/internal/service/apigateway/domain_name_test.go @@ -305,7 +305,7 @@ func TestAccAPIGatewayDomainName_mutualTLSAuthentication(t *testing.T) { var v apigateway.DomainName resourceName := "aws_api_gateway_domain_name.test" acmCertificateResourceName := "aws_acm_certificate.test" - s3BucketObjectResourceName := "aws_s3_object.test" + s3ObjectResourceName := "aws_s3_object.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ @@ -322,7 +322,7 @@ func TestAccAPIGatewayDomainName_mutualTLSAuthentication(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, "domain_name", acmCertificateResourceName, "domain_name"), resource.TestCheckResourceAttr(resourceName, "mutual_tls_authentication.#", "1"), resource.TestCheckResourceAttr(resourceName, "mutual_tls_authentication.0.truststore_uri", fmt.Sprintf("s3://%s/%s", rName, rName)), - resource.TestCheckResourceAttrPair(resourceName, "mutual_tls_authentication.0.truststore_version", s3BucketObjectResourceName, "version_id"), + resource.TestCheckResourceAttrPair(resourceName, "mutual_tls_authentication.0.truststore_version", s3ObjectResourceName, "version_id"), ), }, { diff --git a/internal/service/apigatewayv2/domain_name_test.go b/internal/service/apigatewayv2/domain_name_test.go index 0e8024d2073..933bd93dcb1 100644 --- a/internal/service/apigatewayv2/domain_name_test.go +++ b/internal/service/apigatewayv2/domain_name_test.go @@ -221,7 +221,7 @@ func TestAccAPIGatewayV2DomainName_mutualTLSAuthentication(t *testing.T) { var v apigatewayv2.GetDomainNameOutput resourceName := "aws_apigatewayv2_domain_name.test" acmCertificateResourceName := "aws_acm_certificate.test" - s3BucketObjectResourceName := "aws_s3_object.test" + s3ObjectResourceName := "aws_s3_object.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ @@ -262,7 +262,7 @@ func TestAccAPIGatewayV2DomainName_mutualTLSAuthentication(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "domain_name_configuration.0.target_domain_name"), resource.TestCheckResourceAttr(resourceName, "mutual_tls_authentication.#", "1"), resource.TestCheckResourceAttr(resourceName, "mutual_tls_authentication.0.truststore_uri", fmt.Sprintf("s3://%s/%s", rName, rName)), - resource.TestCheckResourceAttrPair(resourceName, "mutual_tls_authentication.0.truststore_version", s3BucketObjectResourceName, "version_id"), + resource.TestCheckResourceAttrPair(resourceName, "mutual_tls_authentication.0.truststore_version", s3ObjectResourceName, "version_id"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), ), }, @@ -280,7 +280,7 @@ func TestAccAPIGatewayV2DomainName_mutualTLSAuthentication(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "domain_name_configuration.0.target_domain_name"), resource.TestCheckResourceAttr(resourceName, "mutual_tls_authentication.#", "1"), resource.TestCheckResourceAttr(resourceName, "mutual_tls_authentication.0.truststore_uri", fmt.Sprintf("s3://%s/%s", rName, rName)), - resource.TestCheckResourceAttrPair(resourceName, "mutual_tls_authentication.0.truststore_version", s3BucketObjectResourceName, "version_id"), + resource.TestCheckResourceAttrPair(resourceName, "mutual_tls_authentication.0.truststore_version", s3ObjectResourceName, "version_id"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), ), }, diff --git a/internal/service/ec2/ebs_snapshot_import_test.go b/internal/service/ec2/ebs_snapshot_import_test.go index cf35e234ae6..0ed1025e113 100644 --- a/internal/service/ec2/ebs_snapshot_import_test.go +++ b/internal/service/ec2/ebs_snapshot_import_test.go @@ -136,7 +136,7 @@ func TestAccEC2EBSSnapshotImport_disappears(t *testing.T) { }) } -func TestAccEC2EBSSnapshotImport_Disappears_s3BucketObject(t *testing.T) { +func TestAccEC2EBSSnapshotImport_Disappears_s3Object(t *testing.T) { var v ec2.Snapshot rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) parentResourceName := "aws_s3_object.image" @@ -155,7 +155,7 @@ func TestAccEC2EBSSnapshotImport_Disappears_s3BucketObject(t *testing.T) { acctest.MatchResourceAttrRegionalARNNoAccount(resourceName, "arn", "ec2", regexp.MustCompile(`snapshot/snap-.+`)), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), acctest.CheckResourceAttrAccountID(resourceName, "owner_id"), - acctest.CheckResourceDisappears(acctest.Provider, tfs3.ResourceBucketObject(), parentResourceName), + acctest.CheckResourceDisappears(acctest.Provider, tfs3.ResourceObject(), parentResourceName), ), ExpectNonEmptyPlan: true, }, diff --git a/internal/service/kinesisanalyticsv2/application_test.go b/internal/service/kinesisanalyticsv2/application_test.go index 4ba72b4f553..3dcbeae9eda 100644 --- a/internal/service/kinesisanalyticsv2/application_test.go +++ b/internal/service/kinesisanalyticsv2/application_test.go @@ -595,7 +595,7 @@ func TestAccKinesisAnalyticsV2Application_EnvironmentProperties_update(t *testin resourceName := "aws_kinesisanalyticsv2_application.test" iamRoleResourceName := "aws_iam_role.test.0" s3BucketResourceName := "aws_s3_bucket.test" - s3BucketObjectResourceName := "aws_s3_object.test.0" + s3ObjectResourceName := "aws_s3_object.test.0" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ @@ -613,7 +613,7 @@ func TestAccKinesisAnalyticsV2Application_EnvironmentProperties_update(t *testin resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.#", "1"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.#", "1"), resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.bucket_arn", s3BucketResourceName, "arn"), - resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3BucketObjectResourceName, "key"), + resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3ObjectResourceName, "key"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.object_version", ""), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content_type", "ZIPFILE"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_snapshot_configuration.#", "1"), @@ -674,7 +674,7 @@ func TestAccKinesisAnalyticsV2Application_EnvironmentProperties_update(t *testin resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.#", "1"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.#", "1"), resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.bucket_arn", s3BucketResourceName, "arn"), - resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3BucketObjectResourceName, "key"), + resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3ObjectResourceName, "key"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.object_version", ""), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content_type", "ZIPFILE"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_snapshot_configuration.#", "1"), @@ -743,7 +743,7 @@ func TestAccKinesisAnalyticsV2Application_EnvironmentProperties_update(t *testin resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.#", "1"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.#", "1"), resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.bucket_arn", s3BucketResourceName, "arn"), - resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3BucketObjectResourceName, "key"), + resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3ObjectResourceName, "key"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.object_version", ""), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content_type", "ZIPFILE"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_snapshot_configuration.#", "1"), @@ -791,8 +791,8 @@ func TestAccKinesisAnalyticsV2Application_FlinkApplication_update(t *testing.T) resourceName := "aws_kinesisanalyticsv2_application.test" iamRoleResourceName := "aws_iam_role.test.0" s3BucketResourceName := "aws_s3_bucket.test" - s3BucketObject1ResourceName := "aws_s3_object.test.0" - s3BucketObject2ResourceName := "aws_s3_object.test.1" + s3Object1ResourceName := "aws_s3_object.test.0" + s3Object2ResourceName := "aws_s3_object.test.1" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ @@ -810,8 +810,8 @@ func TestAccKinesisAnalyticsV2Application_FlinkApplication_update(t *testing.T) resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.#", "1"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.#", "1"), resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.bucket_arn", s3BucketResourceName, "arn"), - resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3BucketObject1ResourceName, "key"), - resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.object_version", s3BucketObject1ResourceName, "version_id"), + resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3Object1ResourceName, "key"), + resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.object_version", s3Object1ResourceName, "version_id"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content_type", "ZIPFILE"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_snapshot_configuration.#", "1"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_snapshot_configuration.0.snapshots_enabled", "false"), @@ -858,8 +858,8 @@ func TestAccKinesisAnalyticsV2Application_FlinkApplication_update(t *testing.T) resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.#", "1"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.#", "1"), resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.bucket_arn", s3BucketResourceName, "arn"), - resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3BucketObject2ResourceName, "key"), - resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.object_version", s3BucketObject2ResourceName, "version_id"), + resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3Object2ResourceName, "key"), + resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.object_version", s3Object2ResourceName, "version_id"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content_type", "ZIPFILE"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_snapshot_configuration.#", "1"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_snapshot_configuration.0.snapshots_enabled", "false"), @@ -912,8 +912,8 @@ func TestAccKinesisAnalyticsV2Application_FlinkApplicationEnvironmentProperties_ iamRole1ResourceName := "aws_iam_role.test.0" iamRole2ResourceName := "aws_iam_role.test.1" s3BucketResourceName := "aws_s3_bucket.test" - s3BucketObject1ResourceName := "aws_s3_object.test.0" - s3BucketObject2ResourceName := "aws_s3_object.test.1" + s3Object1ResourceName := "aws_s3_object.test.0" + s3Object2ResourceName := "aws_s3_object.test.1" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ @@ -931,8 +931,8 @@ func TestAccKinesisAnalyticsV2Application_FlinkApplicationEnvironmentProperties_ resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.#", "1"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.#", "1"), resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.bucket_arn", s3BucketResourceName, "arn"), - resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3BucketObject1ResourceName, "key"), - resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.object_version", s3BucketObject1ResourceName, "version_id"), + resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3Object1ResourceName, "key"), + resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.object_version", s3Object1ResourceName, "version_id"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content_type", "ZIPFILE"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_snapshot_configuration.#", "1"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_snapshot_configuration.0.snapshots_enabled", "false"), @@ -993,8 +993,8 @@ func TestAccKinesisAnalyticsV2Application_FlinkApplicationEnvironmentProperties_ resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.#", "1"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.#", "1"), resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.bucket_arn", s3BucketResourceName, "arn"), - resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3BucketObject2ResourceName, "key"), - resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.object_version", s3BucketObject2ResourceName, "version_id"), + resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3Object2ResourceName, "key"), + resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.object_version", s3Object2ResourceName, "version_id"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content_type", "ZIPFILE"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_snapshot_configuration.#", "1"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_snapshot_configuration.0.snapshots_enabled", "true"), @@ -1064,7 +1064,7 @@ func TestAccKinesisAnalyticsV2Application_FlinkApplication_restoreFromSnapshot(t resourceName := "aws_kinesisanalyticsv2_application.test" iamRoleResourceName := "aws_iam_role.test.0" s3BucketResourceName := "aws_s3_bucket.test" - s3BucketObjectResourceName := "aws_s3_object.test" + s3ObjectResourceName := "aws_s3_object.test" snapshotResourceName := "aws_kinesisanalyticsv2_application_snapshot.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -1083,7 +1083,7 @@ func TestAccKinesisAnalyticsV2Application_FlinkApplication_restoreFromSnapshot(t resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.#", "1"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.#", "1"), resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.bucket_arn", s3BucketResourceName, "arn"), - resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3BucketObjectResourceName, "key"), + resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3ObjectResourceName, "key"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.object_version", ""), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.text_content", ""), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content_type", "ZIPFILE"), @@ -1147,7 +1147,7 @@ func TestAccKinesisAnalyticsV2Application_FlinkApplication_restoreFromSnapshot(t resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.#", "1"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.#", "1"), resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.bucket_arn", s3BucketResourceName, "arn"), - resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3BucketObjectResourceName, "key"), + resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3ObjectResourceName, "key"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.object_version", ""), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.text_content", ""), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content_type", "ZIPFILE"), @@ -1212,7 +1212,7 @@ func TestAccKinesisAnalyticsV2Application_FlinkApplication_restoreFromSnapshot(t resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.#", "1"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.#", "1"), resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.bucket_arn", s3BucketResourceName, "arn"), - resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3BucketObjectResourceName, "key"), + resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3ObjectResourceName, "key"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.object_version", ""), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.text_content", ""), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content_type", "ZIPFILE"), @@ -1276,7 +1276,7 @@ func TestAccKinesisAnalyticsV2Application_FlinkApplication_restoreFromSnapshot(t resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.#", "1"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.#", "1"), resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.bucket_arn", s3BucketResourceName, "arn"), - resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3BucketObjectResourceName, "key"), + resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3ObjectResourceName, "key"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.object_version", ""), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.text_content", ""), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content_type", "ZIPFILE"), @@ -1335,7 +1335,7 @@ func TestAccKinesisAnalyticsV2Application_FlinkApplicationStartApplication_onCre resourceName := "aws_kinesisanalyticsv2_application.test" iamRoleResourceName := "aws_iam_role.test.0" s3BucketResourceName := "aws_s3_bucket.test" - s3BucketObjectResourceName := "aws_s3_object.test.0" + s3ObjectResourceName := "aws_s3_object.test.0" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ @@ -1353,8 +1353,8 @@ func TestAccKinesisAnalyticsV2Application_FlinkApplicationStartApplication_onCre resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.#", "1"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.#", "1"), resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.bucket_arn", s3BucketResourceName, "arn"), - resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3BucketObjectResourceName, "key"), - resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.object_version", s3BucketObjectResourceName, "version_id"), + resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3ObjectResourceName, "key"), + resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.object_version", s3ObjectResourceName, "version_id"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content_type", "ZIPFILE"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_snapshot_configuration.#", "1"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_snapshot_configuration.0.snapshots_enabled", "false"), @@ -1411,7 +1411,7 @@ func TestAccKinesisAnalyticsV2Application_FlinkApplicationStartApplication_onUpd resourceName := "aws_kinesisanalyticsv2_application.test" iamRoleResourceName := "aws_iam_role.test.0" s3BucketResourceName := "aws_s3_bucket.test" - s3BucketObjectResourceName := "aws_s3_object.test.0" + s3ObjectResourceName := "aws_s3_object.test.0" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ @@ -1429,8 +1429,8 @@ func TestAccKinesisAnalyticsV2Application_FlinkApplicationStartApplication_onUpd resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.#", "1"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.#", "1"), resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.bucket_arn", s3BucketResourceName, "arn"), - resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3BucketObjectResourceName, "key"), - resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.object_version", s3BucketObjectResourceName, "version_id"), + resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3ObjectResourceName, "key"), + resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.object_version", s3ObjectResourceName, "version_id"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content_type", "ZIPFILE"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_snapshot_configuration.#", "1"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_snapshot_configuration.0.snapshots_enabled", "false"), @@ -1483,8 +1483,8 @@ func TestAccKinesisAnalyticsV2Application_FlinkApplicationStartApplication_onUpd resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.#", "1"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.#", "1"), resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.bucket_arn", s3BucketResourceName, "arn"), - resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3BucketObjectResourceName, "key"), - resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.object_version", s3BucketObjectResourceName, "version_id"), + resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3ObjectResourceName, "key"), + resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.object_version", s3ObjectResourceName, "version_id"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content_type", "ZIPFILE"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_snapshot_configuration.#", "1"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_snapshot_configuration.0.snapshots_enabled", "false"), @@ -1535,8 +1535,8 @@ func TestAccKinesisAnalyticsV2Application_FlinkApplicationStartApplication_onUpd resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.#", "1"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.#", "1"), resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.bucket_arn", s3BucketResourceName, "arn"), - resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3BucketObjectResourceName, "key"), - resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.object_version", s3BucketObjectResourceName, "version_id"), + resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3ObjectResourceName, "key"), + resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.object_version", s3ObjectResourceName, "version_id"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content_type", "ZIPFILE"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_snapshot_configuration.#", "1"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_snapshot_configuration.0.snapshots_enabled", "false"), @@ -1583,8 +1583,8 @@ func TestAccKinesisAnalyticsV2Application_FlinkApplication_updateRunning(t *test resourceName := "aws_kinesisanalyticsv2_application.test" iamRoleResourceName := "aws_iam_role.test.0" s3BucketResourceName := "aws_s3_bucket.test" - s3BucketObject1ResourceName := "aws_s3_object.test.0" - s3BucketObject2ResourceName := "aws_s3_object.test.1" + s3Object1ResourceName := "aws_s3_object.test.0" + s3Object2ResourceName := "aws_s3_object.test.1" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resource.ParallelTest(t, resource.TestCase{ @@ -1602,8 +1602,8 @@ func TestAccKinesisAnalyticsV2Application_FlinkApplication_updateRunning(t *test resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.#", "1"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.#", "1"), resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.bucket_arn", s3BucketResourceName, "arn"), - resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3BucketObject1ResourceName, "key"), - resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.object_version", s3BucketObject1ResourceName, "version_id"), + resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3Object1ResourceName, "key"), + resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.object_version", s3Object1ResourceName, "version_id"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content_type", "ZIPFILE"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_snapshot_configuration.#", "1"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_snapshot_configuration.0.snapshots_enabled", "false"), @@ -1660,8 +1660,8 @@ func TestAccKinesisAnalyticsV2Application_FlinkApplication_updateRunning(t *test resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.#", "1"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.#", "1"), resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.bucket_arn", s3BucketResourceName, "arn"), - resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3BucketObject2ResourceName, "key"), - resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.object_version", s3BucketObject2ResourceName, "version_id"), + resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3Object2ResourceName, "key"), + resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.object_version", s3Object2ResourceName, "version_id"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content_type", "ZIPFILE"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_snapshot_configuration.#", "1"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_snapshot_configuration.0.snapshots_enabled", "false"), @@ -3592,7 +3592,7 @@ func TestAccKinesisAnalyticsV2Application_SQLApplicationVPC_add(t *testing.T) { resourceName := "aws_kinesisanalyticsv2_application.test" iamRoleResourceName := "aws_iam_role.test.0" s3BucketResourceName := "aws_s3_bucket.test" - s3BucketObjectResourceName := "aws_s3_object.test.0" + s3ObjectResourceName := "aws_s3_object.test.0" vpcResourceName := "aws_vpc.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -3611,7 +3611,7 @@ func TestAccKinesisAnalyticsV2Application_SQLApplicationVPC_add(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.#", "1"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.#", "1"), resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.bucket_arn", s3BucketResourceName, "arn"), - resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3BucketObjectResourceName, "key"), + resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3ObjectResourceName, "key"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.object_version", ""), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content_type", "ZIPFILE"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_snapshot_configuration.#", "1"), @@ -3659,7 +3659,7 @@ func TestAccKinesisAnalyticsV2Application_SQLApplicationVPC_add(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.#", "1"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.#", "1"), resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.bucket_arn", s3BucketResourceName, "arn"), - resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3BucketObjectResourceName, "key"), + resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3ObjectResourceName, "key"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.object_version", ""), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content_type", "ZIPFILE"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_snapshot_configuration.#", "1"), @@ -3716,7 +3716,7 @@ func TestAccKinesisAnalyticsV2Application_SQLApplicationVPC_delete(t *testing.T) resourceName := "aws_kinesisanalyticsv2_application.test" iamRoleResourceName := "aws_iam_role.test.0" s3BucketResourceName := "aws_s3_bucket.test" - s3BucketObjectResourceName := "aws_s3_object.test.0" + s3ObjectResourceName := "aws_s3_object.test.0" vpcResourceName := "aws_vpc.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -3735,7 +3735,7 @@ func TestAccKinesisAnalyticsV2Application_SQLApplicationVPC_delete(t *testing.T) resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.#", "1"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.#", "1"), resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.bucket_arn", s3BucketResourceName, "arn"), - resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3BucketObjectResourceName, "key"), + resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3ObjectResourceName, "key"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.object_version", ""), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content_type", "ZIPFILE"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_snapshot_configuration.#", "1"), @@ -3787,7 +3787,7 @@ func TestAccKinesisAnalyticsV2Application_SQLApplicationVPC_delete(t *testing.T) resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.#", "1"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.#", "1"), resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.bucket_arn", s3BucketResourceName, "arn"), - resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3BucketObjectResourceName, "key"), + resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3ObjectResourceName, "key"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.object_version", ""), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content_type", "ZIPFILE"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_snapshot_configuration.#", "1"), @@ -3840,7 +3840,7 @@ func TestAccKinesisAnalyticsV2Application_SQLApplicationVPC_update(t *testing.T) resourceName := "aws_kinesisanalyticsv2_application.test" iamRoleResourceName := "aws_iam_role.test.0" s3BucketResourceName := "aws_s3_bucket.test" - s3BucketObjectResourceName := "aws_s3_object.test.0" + s3ObjectResourceName := "aws_s3_object.test.0" vpcResourceName := "aws_vpc.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -3859,7 +3859,7 @@ func TestAccKinesisAnalyticsV2Application_SQLApplicationVPC_update(t *testing.T) resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.#", "1"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.#", "1"), resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.bucket_arn", s3BucketResourceName, "arn"), - resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3BucketObjectResourceName, "key"), + resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3ObjectResourceName, "key"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.object_version", ""), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content_type", "ZIPFILE"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_snapshot_configuration.#", "1"), @@ -3911,7 +3911,7 @@ func TestAccKinesisAnalyticsV2Application_SQLApplicationVPC_update(t *testing.T) resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.#", "1"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.#", "1"), resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.bucket_arn", s3BucketResourceName, "arn"), - resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3BucketObjectResourceName, "key"), + resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3ObjectResourceName, "key"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.object_version", ""), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content_type", "ZIPFILE"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_snapshot_configuration.#", "1"), @@ -3968,7 +3968,7 @@ func TestAccKinesisAnalyticsV2Application_RunConfiguration_Update(t *testing.T) resourceName := "aws_kinesisanalyticsv2_application.test" iamRoleResourceName := "aws_iam_role.test.0" s3BucketResourceName := "aws_s3_bucket.test" - s3BucketObjectResourceName := "aws_s3_object.test" + s3ObjectResourceName := "aws_s3_object.test" snapshotResourceName := "aws_kinesisanalyticsv2_application_snapshot.test" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) @@ -3987,7 +3987,7 @@ func TestAccKinesisAnalyticsV2Application_RunConfiguration_Update(t *testing.T) resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.#", "1"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.#", "1"), resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.bucket_arn", s3BucketResourceName, "arn"), - resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3BucketObjectResourceName, "key"), + resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3ObjectResourceName, "key"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.object_version", ""), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.text_content", ""), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content_type", "ZIPFILE"), @@ -4050,7 +4050,7 @@ func TestAccKinesisAnalyticsV2Application_RunConfiguration_Update(t *testing.T) resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.#", "1"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.#", "1"), resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.bucket_arn", s3BucketResourceName, "arn"), - resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3BucketObjectResourceName, "key"), + resource.TestCheckResourceAttrPair(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.file_key", s3ObjectResourceName, "key"), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.s3_content_location.0.object_version", ""), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content.0.text_content", ""), resource.TestCheckResourceAttr(resourceName, "application_configuration.0.application_code_configuration.0.code_content_type", "ZIPFILE"), diff --git a/internal/service/mwaa/environment_test.go b/internal/service/mwaa/environment_test.go index 798533f600c..84f6bdcea2a 100644 --- a/internal/service/mwaa/environment_test.go +++ b/internal/service/mwaa/environment_test.go @@ -311,7 +311,7 @@ func TestAccMWAAEnvironment_pluginsS3ObjectVersion(t *testing.T) { rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) resourceName := "aws_mwaa_environment.test" - s3BucketObjectResourceName := "aws_s3_object.plugins" + s3ObjectResourceName := "aws_s3_object.plugins" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(t) }, @@ -323,7 +323,7 @@ func TestAccMWAAEnvironment_pluginsS3ObjectVersion(t *testing.T) { Config: testAccEnvironmentPluginsS3ObjectVersionConfig(rName, "test"), Check: resource.ComposeTestCheckFunc( testAccCheckEnvironmentExists(resourceName, &environment), - resource.TestCheckResourceAttrPair(resourceName, "plugins_s3_object_version", s3BucketObjectResourceName, "version_id"), + resource.TestCheckResourceAttrPair(resourceName, "plugins_s3_object_version", s3ObjectResourceName, "version_id"), ), }, { @@ -335,7 +335,7 @@ func TestAccMWAAEnvironment_pluginsS3ObjectVersion(t *testing.T) { Config: testAccEnvironmentPluginsS3ObjectVersionConfig(rName, "test-updated"), Check: resource.ComposeTestCheckFunc( testAccCheckEnvironmentExists(resourceName, &environment), - resource.TestCheckResourceAttrPair(resourceName, "plugins_s3_object_version", s3BucketObjectResourceName, "version_id"), + resource.TestCheckResourceAttrPair(resourceName, "plugins_s3_object_version", s3ObjectResourceName, "version_id"), ), }, { diff --git a/internal/service/s3/bucket.go b/internal/service/s3/bucket.go index 22fe3f8119c..d67168104f9 100644 --- a/internal/service/s3/bucket.go +++ b/internal/service/s3/bucket.go @@ -842,7 +842,7 @@ func resourceBucketUpdate(d *schema.ResourceData, meta interface{}) error { } if d.HasChange("object_lock_configuration") { - if err := resourceBucketObjectLockConfigurationUpdate(conn, d); err != nil { + if err := resourceObjectLockConfigurationUpdate(conn, d); err != nil { return err } } @@ -2014,7 +2014,7 @@ func resourceBucketServerSideEncryptionConfigurationUpdate(conn *s3.S3, d *schem return nil } -func resourceBucketObjectLockConfigurationUpdate(conn *s3.S3, d *schema.ResourceData) error { +func resourceObjectLockConfigurationUpdate(conn *s3.S3, d *schema.ResourceData) error { // S3 Object Lock configuration cannot be deleted, only updated. req := &s3.PutObjectLockConfigurationInput{ Bucket: aws.String(d.Get("bucket").(string)), diff --git a/internal/service/s3/object.go b/internal/service/s3/object.go index 741c6acbcdb..65c9ba7df2d 100644 --- a/internal/service/s3/object.go +++ b/internal/service/s3/object.go @@ -30,21 +30,21 @@ import ( "github.com/mitchellh/go-homedir" ) -const s3BucketObjectCreationTimeout = 2 * time.Minute +const s3ObjectCreationTimeout = 2 * time.Minute -func ResourceBucketObject() *schema.Resource { +func ResourceObject() *schema.Resource { return &schema.Resource{ - Create: resourceBucketObjectCreate, - Read: resourceBucketObjectRead, - Update: resourceBucketObjectUpdate, - Delete: resourceBucketObjectDelete, + Create: resourceObjectCreate, + Read: resourceObjectRead, + Update: resourceObjectUpdate, + Delete: resourceObjectDelete, Importer: &schema.ResourceImporter{ - State: resourceBucketObjectImport, + State: resourceObjectImport, }, CustomizeDiff: customdiff.Sequence( - resourceBucketObjectCustomizeDiff, + resourceObjectCustomizeDiff, verify.SetTagsDiff, ), @@ -186,11 +186,11 @@ func ResourceBucketObject() *schema.Resource { } } -func resourceBucketObjectCreate(d *schema.ResourceData, meta interface{}) error { - return resourceBucketObjectUpload(d, meta) +func resourceObjectCreate(d *schema.ResourceData, meta interface{}) error { + return resourceObjectUpload(d, meta) } -func resourceBucketObjectRead(d *schema.ResourceData, meta interface{}) error { +func resourceObjectRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*conns.AWSClient).S3Conn defaultTagsConfig := meta.(*conns.AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*conns.AWSClient).IgnoreTagsConfig @@ -205,7 +205,7 @@ func resourceBucketObjectRead(d *schema.ResourceData, meta interface{}) error { var resp *s3.HeadObjectOutput - err := resource.Retry(s3BucketObjectCreationTimeout, func() *resource.RetryError { + err := resource.Retry(s3ObjectCreationTimeout, func() *resource.RetryError { var err error resp, err = conn.HeadObject(input) @@ -261,7 +261,7 @@ func resourceBucketObjectRead(d *schema.ResourceData, meta interface{}) error { d.Set("object_lock_mode", resp.ObjectLockMode) d.Set("object_lock_retain_until_date", flattenS3ObjectDate(resp.ObjectLockRetainUntilDate)) - if err := resourceBucketObjectSetKMS(d, meta, resp.SSEKMSKeyId); err != nil { + if err := resourceObjectSetKMS(d, meta, resp.SSEKMSKeyId); err != nil { return fmt.Errorf("bucket object KMS: %w", err) } @@ -304,9 +304,9 @@ func resourceBucketObjectRead(d *schema.ResourceData, meta interface{}) error { return nil } -func resourceBucketObjectUpdate(d *schema.ResourceData, meta interface{}) error { +func resourceObjectUpdate(d *schema.ResourceData, meta interface{}) error { if hasS3ObjectContentChanges(d) { - return resourceBucketObjectUpload(d, meta) + return resourceObjectUpload(d, meta) } conn := meta.(*conns.AWSClient).S3Conn @@ -372,10 +372,10 @@ func resourceBucketObjectUpdate(d *schema.ResourceData, meta interface{}) error } } - return resourceBucketObjectRead(d, meta) + return resourceObjectRead(d, meta) } -func resourceBucketObjectDelete(d *schema.ResourceData, meta interface{}) error { +func resourceObjectDelete(d *schema.ResourceData, meta interface{}) error { conn := meta.(*conns.AWSClient).S3Conn bucket := d.Get("bucket").(string) @@ -399,7 +399,7 @@ func resourceBucketObjectDelete(d *schema.ResourceData, meta interface{}) error return nil } -func resourceBucketObjectImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { +func resourceObjectImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { id := d.Id() id = strings.TrimPrefix(id, "s3://") parts := strings.Split(id, "/") @@ -418,7 +418,7 @@ func resourceBucketObjectImport(d *schema.ResourceData, meta interface{}) ([]*sc return []*schema.ResourceData{d}, nil } -func resourceBucketObjectUpload(d *schema.ResourceData, meta interface{}) error { +func resourceObjectUpload(d *schema.ResourceData, meta interface{}) error { conn := meta.(*conns.AWSClient).S3Conn uploader := s3manager.NewUploaderWithClient(conn) defaultTagsConfig := meta.(*conns.AWSClient).DefaultTagsConfig @@ -538,10 +538,10 @@ func resourceBucketObjectUpload(d *schema.ResourceData, meta interface{}) error d.SetId(key) - return resourceBucketObjectRead(d, meta) + return resourceObjectRead(d, meta) } -func resourceBucketObjectSetKMS(d *schema.ResourceData, meta interface{}, sseKMSKeyId *string) error { +func resourceObjectSetKMS(d *schema.ResourceData, meta interface{}, sseKMSKeyId *string) error { // Only set non-default KMS key ID (one that doesn't match default) if sseKMSKeyId != nil { // retrieve S3 KMS Default Master Key @@ -572,7 +572,7 @@ func validateMetadataIsLowerCase(v interface{}, k string) (ws []string, errors [ return } -func resourceBucketObjectCustomizeDiff(_ context.Context, d *schema.ResourceDiff, meta interface{}) error { +func resourceObjectCustomizeDiff(_ context.Context, d *schema.ResourceDiff, meta interface{}) error { if hasS3ObjectContentChanges(d) { return d.SetNewComputed("version_id") } diff --git a/internal/service/s3/object_copy.go b/internal/service/s3/object_copy.go index 829c1d14ee9..df3a256345a 100644 --- a/internal/service/s3/object_copy.go +++ b/internal/service/s3/object_copy.go @@ -349,7 +349,7 @@ func resourceObjectCopyRead(d *schema.ResourceData, meta interface{}) error { d.Set("object_lock_mode", resp.ObjectLockMode) d.Set("object_lock_retain_until_date", flattenS3ObjectDate(resp.ObjectLockRetainUntilDate)) - if err := resourceBucketObjectSetKMS(d, meta, resp.SSEKMSKeyId); err != nil { + if err := resourceObjectSetKMS(d, meta, resp.SSEKMSKeyId); err != nil { return fmt.Errorf("bucket object KMS: %w", err) } @@ -647,7 +647,7 @@ func resourceObjectCopyDoCopy(d *schema.ResourceData, meta interface{}) error { d.Set("version_id", output.VersionId) d.SetId(d.Get("key").(string)) - return resourceBucketObjectRead(d, meta) + return resourceObjectRead(d, meta) } type s3Grants struct { From eabb12b911069f6a3130eab10f1ff05a3a28e461 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Mon, 31 Jan 2022 12:38:10 -0500 Subject: [PATCH 13/17] Update data sources --- internal/provider/provider.go | 4 ++-- internal/service/s3/object_data_source.go | 6 +++--- internal/service/s3/objects_data_source.go | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/internal/provider/provider.go b/internal/provider/provider.go index cfbbb7236d8..90d0a9c1d82 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -685,8 +685,8 @@ func Provider() *schema.Provider { "aws_canonical_user_id": s3.DataSourceCanonicalUserID(), "aws_s3_bucket": s3.DataSourceBucket(), - "aws_s3_object": s3.DataSourceBucketObject(), - "aws_s3_objects": s3.DataSourceBucketObjects(), + "aws_s3_object": s3.DataSourceObject(), + "aws_s3_objects": s3.DataSourceObjects(), "aws_sagemaker_prebuilt_ecr_image": sagemaker.DataSourcePrebuiltECRImage(), diff --git a/internal/service/s3/object_data_source.go b/internal/service/s3/object_data_source.go index 68d424b2c98..767aca9a499 100644 --- a/internal/service/s3/object_data_source.go +++ b/internal/service/s3/object_data_source.go @@ -16,9 +16,9 @@ import ( tftags "github.com/hashicorp/terraform-provider-aws/internal/tags" ) -func DataSourceBucketObject() *schema.Resource { +func DataSourceObject() *schema.Resource { return &schema.Resource{ - Read: dataSourceBucketObjectRead, + Read: dataSourceObjectRead, Schema: map[string]*schema.Schema{ "body": { @@ -125,7 +125,7 @@ func DataSourceBucketObject() *schema.Resource { } } -func dataSourceBucketObjectRead(d *schema.ResourceData, meta interface{}) error { +func dataSourceObjectRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*conns.AWSClient).S3Conn ignoreTagsConfig := meta.(*conns.AWSClient).IgnoreTagsConfig diff --git a/internal/service/s3/objects_data_source.go b/internal/service/s3/objects_data_source.go index 9c9fc2d856d..5c6503829c2 100644 --- a/internal/service/s3/objects_data_source.go +++ b/internal/service/s3/objects_data_source.go @@ -11,9 +11,9 @@ import ( const keyRequestPageSize = 1000 -func DataSourceBucketObjects() *schema.Resource { +func DataSourceObjects() *schema.Resource { return &schema.Resource{ - Read: dataSourceBucketObjectsRead, + Read: dataSourceObjectsRead, Schema: map[string]*schema.Schema{ "bucket": { @@ -64,7 +64,7 @@ func DataSourceBucketObjects() *schema.Resource { } } -func dataSourceBucketObjectsRead(d *schema.ResourceData, meta interface{}) error { +func dataSourceObjectsRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*conns.AWSClient).S3Conn bucket := d.Get("bucket").(string) From 7a3434ce3374021598b7f5c5b3be85a2bfbf866d Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Mon, 31 Jan 2022 12:39:48 -0500 Subject: [PATCH 14/17] Update function names --- internal/service/s3/bucket_test.go | 8 +- .../service/s3/object_data_source_test.go | 24 +- internal/service/s3/object_test.go | 598 +++++++++--------- internal/service/s3/sweep.go | 4 +- 4 files changed, 317 insertions(+), 317 deletions(-) diff --git a/internal/service/s3/bucket_test.go b/internal/service/s3/bucket_test.go index 0ca48e2f65e..a80e3f076e1 100644 --- a/internal/service/s3/bucket_test.go +++ b/internal/service/s3/bucket_test.go @@ -2528,7 +2528,7 @@ func TestAccS3Bucket_Manage_objectLock(t *testing.T) { CheckDestroy: testAccCheckBucketDestroy, Steps: []resource.TestStep{ { - Config: testAccBucketObjectLockEnabledNoDefaultRetention(bucketName), + Config: testAccObjectLockEnabledNoDefaultRetention(bucketName), Check: resource.ComposeTestCheckFunc( testAccCheckBucketExists(resourceName), resource.TestCheckResourceAttr(resourceName, "object_lock_configuration.#", "1"), @@ -2543,7 +2543,7 @@ func TestAccS3Bucket_Manage_objectLock(t *testing.T) { ImportStateVerifyIgnore: []string{"force_destroy", "acl"}, }, { - Config: testAccBucketObjectLockEnabledWithDefaultRetention(bucketName), + Config: testAccObjectLockEnabledWithDefaultRetention(bucketName), Check: resource.ComposeTestCheckFunc( testAccCheckBucketExists(resourceName), resource.TestCheckResourceAttr(resourceName, "object_lock_configuration.#", "1"), @@ -5042,7 +5042,7 @@ resource "aws_s3_bucket" "bucket" { `, randInt) } -func testAccBucketObjectLockEnabledNoDefaultRetention(bucketName string) string { +func testAccObjectLockEnabledNoDefaultRetention(bucketName string) string { return fmt.Sprintf(` resource "aws_s3_bucket" "arbitrary" { bucket = %[1]q @@ -5054,7 +5054,7 @@ resource "aws_s3_bucket" "arbitrary" { `, bucketName) } -func testAccBucketObjectLockEnabledWithDefaultRetention(bucketName string) string { +func testAccObjectLockEnabledWithDefaultRetention(bucketName string) string { return fmt.Sprintf(` resource "aws_s3_bucket" "arbitrary" { bucket = %[1]q diff --git a/internal/service/s3/object_data_source_test.go b/internal/service/s3/object_data_source_test.go index 3570a81a72e..821a21d273a 100644 --- a/internal/service/s3/object_data_source_test.go +++ b/internal/service/s3/object_data_source_test.go @@ -35,7 +35,7 @@ func TestAccS3ObjectDataSource_basic(t *testing.T) { { Config: testAccObjectDataSourceConfig_basic(rInt), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &rObj), + testAccCheckObjectExists(resourceName, &rObj), testAccCheckObjectExistsDataSource(dataSourceName, &dsObj), resource.TestCheckResourceAttr(dataSourceName, "content_length", "11"), resource.TestCheckResourceAttrPair(dataSourceName, "content_type", resourceName, "content_type"), @@ -67,9 +67,9 @@ func TestAccS3ObjectDataSource_basicViaAccessPoint(t *testing.T) { { Config: testAccObjectDataSourceConfig_basicViaAccessPoint(rName), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &rObj), + testAccCheckObjectExists(resourceName, &rObj), testAccCheckObjectExistsDataSource(dataSourceName, &dsObj), - testAccCheckBucketObjectExists(resourceName, &rObj), + testAccCheckObjectExists(resourceName, &rObj), resource.TestCheckResourceAttrPair(dataSourceName, "bucket", accessPointResourceName, "arn"), resource.TestCheckResourceAttrPair(dataSourceName, "key", resourceName, "key"), ), @@ -96,7 +96,7 @@ func TestAccS3ObjectDataSource_readableBody(t *testing.T) { { Config: testAccObjectDataSourceConfig_readableBody(rInt), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &rObj), + testAccCheckObjectExists(resourceName, &rObj), testAccCheckObjectExistsDataSource(dataSourceName, &dsObj), resource.TestCheckResourceAttr(dataSourceName, "content_length", "3"), resource.TestCheckResourceAttrPair(dataSourceName, "content_type", resourceName, "content_type"), @@ -130,7 +130,7 @@ func TestAccS3ObjectDataSource_kmsEncrypted(t *testing.T) { { Config: testAccObjectDataSourceConfig_kmsEncrypted(rInt), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &rObj), + testAccCheckObjectExists(resourceName, &rObj), testAccCheckObjectExistsDataSource(dataSourceName, &dsObj), resource.TestCheckResourceAttr(dataSourceName, "content_length", "22"), resource.TestCheckResourceAttrPair(dataSourceName, "content_type", resourceName, "content_type"), @@ -166,7 +166,7 @@ func TestAccS3ObjectDataSource_bucketKeyEnabled(t *testing.T) { { Config: testAccObjectDataSourceConfig_bucketKeyEnabled(rInt), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &rObj), + testAccCheckObjectExists(resourceName, &rObj), testAccCheckObjectExistsDataSource(dataSourceName, &dsObj), resource.TestCheckResourceAttr(dataSourceName, "content_length", "22"), resource.TestCheckResourceAttrPair(dataSourceName, "content_type", resourceName, "content_type"), @@ -203,7 +203,7 @@ func TestAccS3ObjectDataSource_allParams(t *testing.T) { { Config: testAccObjectDataSourceConfig_allParams(rInt), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &rObj), + testAccCheckObjectExists(resourceName, &rObj), testAccCheckObjectExistsDataSource(dataSourceName, &dsObj), resource.TestCheckResourceAttr(dataSourceName, "content_length", "25"), resource.TestCheckResourceAttrPair(dataSourceName, "content_type", resourceName, "content_type"), @@ -254,7 +254,7 @@ func TestAccS3ObjectDataSource_objectLockLegalHoldOff(t *testing.T) { { Config: testAccObjectDataSourceConfig_objectLockLegalHoldOff(rInt), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &rObj), + testAccCheckObjectExists(resourceName, &rObj), testAccCheckObjectExistsDataSource(dataSourceName, &dsObj), resource.TestCheckResourceAttr(dataSourceName, "content_length", "11"), resource.TestCheckResourceAttrPair(dataSourceName, "content_type", resourceName, "content_type"), @@ -289,7 +289,7 @@ func TestAccS3ObjectDataSource_objectLockLegalHoldOn(t *testing.T) { { Config: testAccObjectDataSourceConfig_objectLockLegalHoldOn(rInt, retainUntilDate), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &rObj), + testAccCheckObjectExists(resourceName, &rObj), testAccCheckObjectExistsDataSource(dataSourceName, &dsObj), resource.TestCheckResourceAttr(dataSourceName, "content_length", "11"), resource.TestCheckResourceAttrPair(dataSourceName, "content_type", resourceName, "content_type"), @@ -326,7 +326,7 @@ func TestAccS3ObjectDataSource_leadingSlash(t *testing.T) { { Config: resourceOnlyConf, Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &rObj), + testAccCheckObjectExists(resourceName, &rObj), ), }, { @@ -380,8 +380,8 @@ func TestAccS3ObjectDataSource_multipleSlashes(t *testing.T) { { Config: resourceOnlyConf, Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName1, &rObj1), - testAccCheckBucketObjectExists(resourceName2, &rObj2), + testAccCheckObjectExists(resourceName1, &rObj1), + testAccCheckObjectExists(resourceName2, &rObj2), ), }, { diff --git a/internal/service/s3/object_test.go b/internal/service/s3/object_test.go index 69f53a90354..b00ba882372 100644 --- a/internal/service/s3/object_test.go +++ b/internal/service/s3/object_test.go @@ -33,16 +33,16 @@ func TestAccS3Object_noNameNoKey(t *testing.T) { PreCheck: func() { acctest.PreCheck(t) }, ErrorCheck: acctest.ErrorCheck(t, s3.EndpointsID), Providers: acctest.Providers, - CheckDestroy: testAccCheckBucketObjectDestroy, + CheckDestroy: testAccCheckObjectDestroy, Steps: []resource.TestStep{ { PreConfig: func() {}, - Config: testAccBucketObjectBasicConfig("", "a key"), + Config: testAccObjectBasicConfig("", "a key"), ExpectError: bucketError, }, { PreConfig: func() {}, - Config: testAccBucketObjectBasicConfig("a name", ""), + Config: testAccObjectBasicConfig("a name", ""), ExpectError: keyError, }, }, @@ -58,14 +58,14 @@ func TestAccS3Object_empty(t *testing.T) { PreCheck: func() { acctest.PreCheck(t) }, ErrorCheck: acctest.ErrorCheck(t, s3.EndpointsID), Providers: acctest.Providers, - CheckDestroy: testAccCheckBucketObjectDestroy, + CheckDestroy: testAccCheckObjectDestroy, Steps: []resource.TestStep{ { PreConfig: func() {}, - Config: testAccBucketObjectEmptyConfig(rName), + Config: testAccObjectEmptyConfig(rName), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj), - testAccCheckBucketObjectBody(&obj, ""), + testAccCheckObjectExists(resourceName, &obj), + testAccCheckObjectBody(&obj, ""), ), }, { @@ -84,20 +84,20 @@ func TestAccS3Object_source(t *testing.T) { resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - source := testAccBucketObjectCreateTempFile(t, "{anything will do }") + source := testAccObjectCreateTempFile(t, "{anything will do }") defer os.Remove(source) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(t) }, ErrorCheck: acctest.ErrorCheck(t, s3.EndpointsID), Providers: acctest.Providers, - CheckDestroy: testAccCheckBucketObjectDestroy, + CheckDestroy: testAccCheckObjectDestroy, Steps: []resource.TestStep{ { - Config: testAccBucketObjectSourceConfig(rName, source), + Config: testAccObjectSourceConfig(rName, source), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj), - testAccCheckBucketObjectBody(&obj, "{anything will do }"), + testAccCheckObjectExists(resourceName, &obj), + testAccCheckObjectBody(&obj, "{anything will do }"), ), }, { @@ -120,14 +120,14 @@ func TestAccS3Object_content(t *testing.T) { PreCheck: func() { acctest.PreCheck(t) }, ErrorCheck: acctest.ErrorCheck(t, s3.EndpointsID), Providers: acctest.Providers, - CheckDestroy: testAccCheckBucketObjectDestroy, + CheckDestroy: testAccCheckObjectDestroy, Steps: []resource.TestStep{ { PreConfig: func() {}, - Config: testAccBucketObjectContentConfig(rName, "some_bucket_content"), + Config: testAccObjectContentConfig(rName, "some_bucket_content"), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj), - testAccCheckBucketObjectBody(&obj, "some_bucket_content"), + testAccCheckObjectExists(resourceName, &obj), + testAccCheckObjectBody(&obj, "some_bucket_content"), ), }, { @@ -145,21 +145,21 @@ func TestAccS3Object_etagEncryption(t *testing.T) { var obj s3.GetObjectOutput resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - source := testAccBucketObjectCreateTempFile(t, "{anything will do }") + source := testAccObjectCreateTempFile(t, "{anything will do }") defer os.Remove(source) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(t) }, ErrorCheck: acctest.ErrorCheck(t, s3.EndpointsID), Providers: acctest.Providers, - CheckDestroy: testAccCheckBucketObjectDestroy, + CheckDestroy: testAccCheckObjectDestroy, Steps: []resource.TestStep{ { PreConfig: func() {}, - Config: testAccBucketObjectEtagEncryption(rName, source), + Config: testAccObjectEtagEncryption(rName, source), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj), - testAccCheckBucketObjectBody(&obj, "{anything will do }"), + testAccCheckObjectExists(resourceName, &obj), + testAccCheckObjectBody(&obj, "{anything will do }"), resource.TestCheckResourceAttr(resourceName, "etag", "7b006ff4d70f68cc65061acf2f802e6f"), ), }, @@ -183,14 +183,14 @@ func TestAccS3Object_contentBase64(t *testing.T) { PreCheck: func() { acctest.PreCheck(t) }, ErrorCheck: acctest.ErrorCheck(t, s3.EndpointsID), Providers: acctest.Providers, - CheckDestroy: testAccCheckBucketObjectDestroy, + CheckDestroy: testAccCheckObjectDestroy, Steps: []resource.TestStep{ { PreConfig: func() {}, - Config: testAccBucketObjectContentBase64Config(rName, base64.StdEncoding.EncodeToString([]byte("some_bucket_content"))), + Config: testAccObjectContentBase64Config(rName, base64.StdEncoding.EncodeToString([]byte("some_bucket_content"))), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj), - testAccCheckBucketObjectBody(&obj, "some_bucket_content"), + testAccCheckObjectExists(resourceName, &obj), + testAccCheckObjectBody(&obj, "some_bucket_content"), ), }, }, @@ -205,7 +205,7 @@ func TestAccS3Object_sourceHashTrigger(t *testing.T) { startingData := "Ebben!" changingData := "Ne andrò lontana" - filename := testAccBucketObjectCreateTempFile(t, startingData) + filename := testAccObjectCreateTempFile(t, startingData) defer os.Remove(filename) rewriteFile := func(*terraform.State) error { @@ -220,14 +220,14 @@ func TestAccS3Object_sourceHashTrigger(t *testing.T) { PreCheck: func() { acctest.PreCheck(t) }, ErrorCheck: acctest.ErrorCheck(t, s3.EndpointsID), Providers: acctest.Providers, - CheckDestroy: testAccCheckBucketObjectDestroy, + CheckDestroy: testAccCheckObjectDestroy, Steps: []resource.TestStep{ { PreConfig: func() {}, - Config: testAccBucketObjectConfig_sourceHashTrigger(rName, filename), + Config: testAccObjectConfig_sourceHashTrigger(rName, filename), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj), - testAccCheckBucketObjectBody(&obj, "Ebben!"), + testAccCheckObjectExists(resourceName, &obj), + testAccCheckObjectBody(&obj, "Ebben!"), resource.TestCheckResourceAttr(resourceName, "source_hash", "7c7e02a79f28968882bb1426c8f8bfc6"), rewriteFile, ), @@ -235,10 +235,10 @@ func TestAccS3Object_sourceHashTrigger(t *testing.T) { }, { PreConfig: func() {}, - Config: testAccBucketObjectConfig_sourceHashTrigger(rName, filename), + Config: testAccObjectConfig_sourceHashTrigger(rName, filename), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &updated_obj), - testAccCheckBucketObjectBody(&updated_obj, "Ne andrò lontana"), + testAccCheckObjectExists(resourceName, &updated_obj), + testAccCheckObjectBody(&updated_obj, "Ne andrò lontana"), resource.TestCheckResourceAttr(resourceName, "source_hash", "cffc5e20de2d21764145b1124c9b337b"), ), }, @@ -258,20 +258,20 @@ func TestAccS3Object_withContentCharacteristics(t *testing.T) { resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - source := testAccBucketObjectCreateTempFile(t, "{anything will do }") + source := testAccObjectCreateTempFile(t, "{anything will do }") defer os.Remove(source) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(t) }, ErrorCheck: acctest.ErrorCheck(t, s3.EndpointsID), Providers: acctest.Providers, - CheckDestroy: testAccCheckBucketObjectDestroy, + CheckDestroy: testAccCheckObjectDestroy, Steps: []resource.TestStep{ { - Config: testAccBucketObjectConfig_withContentCharacteristics(rName, source), + Config: testAccObjectConfig_withContentCharacteristics(rName, source), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj), - testAccCheckBucketObjectBody(&obj, "{anything will do }"), + testAccCheckObjectExists(resourceName, &obj), + testAccCheckObjectBody(&obj, "{anything will do }"), resource.TestCheckResourceAttr(resourceName, "content_type", "binary/octet-stream"), resource.TestCheckResourceAttr(resourceName, "website_redirect", "http://google.com"), ), @@ -281,7 +281,7 @@ func TestAccS3Object_withContentCharacteristics(t *testing.T) { } func TestAccS3Object_nonVersioned(t *testing.T) { - sourceInitial := testAccBucketObjectCreateTempFile(t, "initial object state") + sourceInitial := testAccObjectCreateTempFile(t, "initial object state") defer os.Remove(sourceInitial) rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) var originalObj s3.GetObjectOutput @@ -291,13 +291,13 @@ func TestAccS3Object_nonVersioned(t *testing.T) { PreCheck: func() { acctest.PreCheck(t); acctest.PreCheckAssumeRoleARN(t) }, ErrorCheck: acctest.ErrorCheck(t, s3.EndpointsID), Providers: acctest.Providers, - CheckDestroy: testAccCheckBucketObjectDestroy, + CheckDestroy: testAccCheckObjectDestroy, Steps: []resource.TestStep{ { - Config: testAccBucketObjectConfig_nonVersioned(rName, sourceInitial), + Config: testAccObjectConfig_nonVersioned(rName, sourceInitial), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &originalObj), - testAccCheckBucketObjectBody(&originalObj, "initial object state"), + testAccCheckObjectExists(resourceName, &originalObj), + testAccCheckObjectBody(&originalObj, "initial object state"), resource.TestCheckResourceAttr(resourceName, "version_id", ""), ), }, @@ -317,22 +317,22 @@ func TestAccS3Object_updates(t *testing.T) { resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - sourceInitial := testAccBucketObjectCreateTempFile(t, "initial object state") + sourceInitial := testAccObjectCreateTempFile(t, "initial object state") defer os.Remove(sourceInitial) - sourceModified := testAccBucketObjectCreateTempFile(t, "modified object") + sourceModified := testAccObjectCreateTempFile(t, "modified object") defer os.Remove(sourceInitial) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(t) }, ErrorCheck: acctest.ErrorCheck(t, s3.EndpointsID), Providers: acctest.Providers, - CheckDestroy: testAccCheckBucketObjectDestroy, + CheckDestroy: testAccCheckObjectDestroy, Steps: []resource.TestStep{ { - Config: testAccBucketObjectConfig_updateable(rName, false, sourceInitial), + Config: testAccObjectConfig_updateable(rName, false, sourceInitial), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &originalObj), - testAccCheckBucketObjectBody(&originalObj, "initial object state"), + testAccCheckObjectExists(resourceName, &originalObj), + testAccCheckObjectBody(&originalObj, "initial object state"), resource.TestCheckResourceAttr(resourceName, "etag", "647d1d58e1011c743ec67d5e8af87b53"), resource.TestCheckResourceAttr(resourceName, "object_lock_legal_hold_status", ""), resource.TestCheckResourceAttr(resourceName, "object_lock_mode", ""), @@ -340,10 +340,10 @@ func TestAccS3Object_updates(t *testing.T) { ), }, { - Config: testAccBucketObjectConfig_updateable(rName, false, sourceModified), + Config: testAccObjectConfig_updateable(rName, false, sourceModified), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &modifiedObj), - testAccCheckBucketObjectBody(&modifiedObj, "modified object"), + testAccCheckObjectExists(resourceName, &modifiedObj), + testAccCheckObjectBody(&modifiedObj, "modified object"), resource.TestCheckResourceAttr(resourceName, "etag", "1c7fd13df1515c2a13ad9eb068931f09"), resource.TestCheckResourceAttr(resourceName, "object_lock_legal_hold_status", ""), resource.TestCheckResourceAttr(resourceName, "object_lock_mode", ""), @@ -369,7 +369,7 @@ func TestAccS3Object_updateSameFile(t *testing.T) { startingData := "lane 8" changingData := "chicane" - filename := testAccBucketObjectCreateTempFile(t, startingData) + filename := testAccObjectCreateTempFile(t, startingData) defer os.Remove(filename) rewriteFile := func(*terraform.State) error { @@ -384,23 +384,23 @@ func TestAccS3Object_updateSameFile(t *testing.T) { PreCheck: func() { acctest.PreCheck(t) }, ErrorCheck: acctest.ErrorCheck(t, s3.EndpointsID), Providers: acctest.Providers, - CheckDestroy: testAccCheckBucketObjectDestroy, + CheckDestroy: testAccCheckObjectDestroy, Steps: []resource.TestStep{ { - Config: testAccBucketObjectConfig_updateable(rName, false, filename), + Config: testAccObjectConfig_updateable(rName, false, filename), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &originalObj), - testAccCheckBucketObjectBody(&originalObj, startingData), + testAccCheckObjectExists(resourceName, &originalObj), + testAccCheckObjectBody(&originalObj, startingData), resource.TestCheckResourceAttr(resourceName, "etag", "aa48b42f36a2652cbee40c30a5df7d25"), rewriteFile, ), ExpectNonEmptyPlan: true, }, { - Config: testAccBucketObjectConfig_updateable(rName, false, filename), + Config: testAccObjectConfig_updateable(rName, false, filename), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &modifiedObj), - testAccCheckBucketObjectBody(&modifiedObj, changingData), + testAccCheckObjectExists(resourceName, &modifiedObj), + testAccCheckObjectBody(&modifiedObj, changingData), resource.TestCheckResourceAttr(resourceName, "etag", "fafc05f8c4da0266a99154681ab86e8c"), ), }, @@ -413,32 +413,32 @@ func TestAccS3Object_updatesWithVersioning(t *testing.T) { resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - sourceInitial := testAccBucketObjectCreateTempFile(t, "initial versioned object state") + sourceInitial := testAccObjectCreateTempFile(t, "initial versioned object state") defer os.Remove(sourceInitial) - sourceModified := testAccBucketObjectCreateTempFile(t, "modified versioned object") + sourceModified := testAccObjectCreateTempFile(t, "modified versioned object") defer os.Remove(sourceInitial) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(t) }, ErrorCheck: acctest.ErrorCheck(t, s3.EndpointsID), Providers: acctest.Providers, - CheckDestroy: testAccCheckBucketObjectDestroy, + CheckDestroy: testAccCheckObjectDestroy, Steps: []resource.TestStep{ { - Config: testAccBucketObjectConfig_updateable(rName, true, sourceInitial), + Config: testAccObjectConfig_updateable(rName, true, sourceInitial), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &originalObj), - testAccCheckBucketObjectBody(&originalObj, "initial versioned object state"), + testAccCheckObjectExists(resourceName, &originalObj), + testAccCheckObjectBody(&originalObj, "initial versioned object state"), resource.TestCheckResourceAttr(resourceName, "etag", "cee4407fa91906284e2a5e5e03e86b1b"), ), }, { - Config: testAccBucketObjectConfig_updateable(rName, true, sourceModified), + Config: testAccObjectConfig_updateable(rName, true, sourceModified), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &modifiedObj), - testAccCheckBucketObjectBody(&modifiedObj, "modified versioned object"), + testAccCheckObjectExists(resourceName, &modifiedObj), + testAccCheckObjectBody(&modifiedObj, "modified versioned object"), resource.TestCheckResourceAttr(resourceName, "etag", "00b8c73b1b50e7cc932362c7225b8e29"), - testAccCheckBucketObjectVersionIdDiffers(&modifiedObj, &originalObj), + testAccCheckObjectVersionIdDiffers(&modifiedObj, &originalObj), ), }, { @@ -458,33 +458,33 @@ func TestAccS3Object_updatesWithVersioningViaAccessPoint(t *testing.T) { resourceName := "aws_s3_object.test" accessPointResourceName := "aws_s3_access_point.test" - sourceInitial := testAccBucketObjectCreateTempFile(t, "initial versioned object state") + sourceInitial := testAccObjectCreateTempFile(t, "initial versioned object state") defer os.Remove(sourceInitial) - sourceModified := testAccBucketObjectCreateTempFile(t, "modified versioned object") + sourceModified := testAccObjectCreateTempFile(t, "modified versioned object") defer os.Remove(sourceInitial) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(t) }, ErrorCheck: acctest.ErrorCheck(t, s3.EndpointsID), Providers: acctest.Providers, - CheckDestroy: testAccCheckBucketObjectDestroy, + CheckDestroy: testAccCheckObjectDestroy, Steps: []resource.TestStep{ { - Config: testAccBucketObjectConfig_updateableViaAccessPoint(rName, true, sourceInitial), + Config: testAccObjectConfig_updateableViaAccessPoint(rName, true, sourceInitial), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &originalObj), - testAccCheckBucketObjectBody(&originalObj, "initial versioned object state"), + testAccCheckObjectExists(resourceName, &originalObj), + testAccCheckObjectBody(&originalObj, "initial versioned object state"), resource.TestCheckResourceAttrPair(resourceName, "bucket", accessPointResourceName, "arn"), resource.TestCheckResourceAttr(resourceName, "etag", "cee4407fa91906284e2a5e5e03e86b1b"), ), }, { - Config: testAccBucketObjectConfig_updateableViaAccessPoint(rName, true, sourceModified), + Config: testAccObjectConfig_updateableViaAccessPoint(rName, true, sourceModified), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &modifiedObj), - testAccCheckBucketObjectBody(&modifiedObj, "modified versioned object"), + testAccCheckObjectExists(resourceName, &modifiedObj), + testAccCheckObjectBody(&modifiedObj, "modified versioned object"), resource.TestCheckResourceAttr(resourceName, "etag", "00b8c73b1b50e7cc932362c7225b8e29"), - testAccCheckBucketObjectVersionIdDiffers(&modifiedObj, &originalObj), + testAccCheckObjectVersionIdDiffers(&modifiedObj, &originalObj), ), }, }, @@ -496,22 +496,22 @@ func TestAccS3Object_kms(t *testing.T) { resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - source := testAccBucketObjectCreateTempFile(t, "{anything will do }") + source := testAccObjectCreateTempFile(t, "{anything will do }") defer os.Remove(source) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(t) }, ErrorCheck: acctest.ErrorCheck(t, s3.EndpointsID), Providers: acctest.Providers, - CheckDestroy: testAccCheckBucketObjectDestroy, + CheckDestroy: testAccCheckObjectDestroy, Steps: []resource.TestStep{ { PreConfig: func() {}, - Config: testAccBucketObjectConfig_withKMSID(rName, source), + Config: testAccObjectConfig_withKMSID(rName, source), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj), - testAccCheckBucketObjectSSE(resourceName, "aws:kms"), - testAccCheckBucketObjectBody(&obj, "{anything will do }"), + testAccCheckObjectExists(resourceName, &obj), + testAccCheckObjectSSE(resourceName, "aws:kms"), + testAccCheckObjectBody(&obj, "{anything will do }"), ), }, { @@ -530,22 +530,22 @@ func TestAccS3Object_sse(t *testing.T) { resourceName := "aws_s3_object.object" rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - source := testAccBucketObjectCreateTempFile(t, "{anything will do }") + source := testAccObjectCreateTempFile(t, "{anything will do }") defer os.Remove(source) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(t) }, ErrorCheck: acctest.ErrorCheck(t, s3.EndpointsID), Providers: acctest.Providers, - CheckDestroy: testAccCheckBucketObjectDestroy, + CheckDestroy: testAccCheckObjectDestroy, Steps: []resource.TestStep{ { PreConfig: func() {}, - Config: testAccBucketObjectConfig_withSSE(rName, source), + Config: testAccObjectConfig_withSSE(rName, source), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj), - testAccCheckBucketObjectSSE(resourceName, "AES256"), - testAccCheckBucketObjectBody(&obj, "{anything will do }"), + testAccCheckObjectExists(resourceName, &obj), + testAccCheckObjectSSE(resourceName, "AES256"), + testAccCheckObjectBody(&obj, "{anything will do }"), ), }, { @@ -568,35 +568,35 @@ func TestAccS3Object_acl(t *testing.T) { PreCheck: func() { acctest.PreCheck(t) }, ErrorCheck: acctest.ErrorCheck(t, s3.EndpointsID), Providers: acctest.Providers, - CheckDestroy: testAccCheckBucketObjectDestroy, + CheckDestroy: testAccCheckObjectDestroy, Steps: []resource.TestStep{ { - Config: testAccBucketObjectConfig_acl(rName, "some_bucket_content", "private"), + Config: testAccObjectConfig_acl(rName, "some_bucket_content", "private"), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj1), - testAccCheckBucketObjectBody(&obj1, "some_bucket_content"), + testAccCheckObjectExists(resourceName, &obj1), + testAccCheckObjectBody(&obj1, "some_bucket_content"), resource.TestCheckResourceAttr(resourceName, "acl", "private"), - testAccCheckBucketObjectACL(resourceName, []string{"FULL_CONTROL"}), + testAccCheckObjectACL(resourceName, []string{"FULL_CONTROL"}), ), }, { - Config: testAccBucketObjectConfig_acl(rName, "some_bucket_content", "public-read"), + Config: testAccObjectConfig_acl(rName, "some_bucket_content", "public-read"), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj2), - testAccCheckBucketObjectVersionIdEquals(&obj2, &obj1), - testAccCheckBucketObjectBody(&obj2, "some_bucket_content"), + testAccCheckObjectExists(resourceName, &obj2), + testAccCheckObjectVersionIdEquals(&obj2, &obj1), + testAccCheckObjectBody(&obj2, "some_bucket_content"), resource.TestCheckResourceAttr(resourceName, "acl", "public-read"), - testAccCheckBucketObjectACL(resourceName, []string{"FULL_CONTROL", "READ"}), + testAccCheckObjectACL(resourceName, []string{"FULL_CONTROL", "READ"}), ), }, { - Config: testAccBucketObjectConfig_acl(rName, "changed_some_bucket_content", "private"), + Config: testAccObjectConfig_acl(rName, "changed_some_bucket_content", "private"), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj3), - testAccCheckBucketObjectVersionIdDiffers(&obj3, &obj2), - testAccCheckBucketObjectBody(&obj3, "changed_some_bucket_content"), + testAccCheckObjectExists(resourceName, &obj3), + testAccCheckObjectVersionIdDiffers(&obj3, &obj2), + testAccCheckObjectBody(&obj3, "changed_some_bucket_content"), resource.TestCheckResourceAttr(resourceName, "acl", "private"), - testAccCheckBucketObjectACL(resourceName, []string{"FULL_CONTROL"}), + testAccCheckObjectACL(resourceName, []string{"FULL_CONTROL"}), ), }, { @@ -619,30 +619,30 @@ func TestAccS3Object_metadata(t *testing.T) { PreCheck: func() { acctest.PreCheck(t) }, ErrorCheck: acctest.ErrorCheck(t, s3.EndpointsID), Providers: acctest.Providers, - CheckDestroy: testAccCheckBucketObjectDestroy, + CheckDestroy: testAccCheckObjectDestroy, Steps: []resource.TestStep{ { - Config: testAccBucketObjectConfig_withMetadata(rName, "key1", "value1", "key2", "value2"), + Config: testAccObjectConfig_withMetadata(rName, "key1", "value1", "key2", "value2"), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj), + testAccCheckObjectExists(resourceName, &obj), resource.TestCheckResourceAttr(resourceName, "metadata.%", "2"), resource.TestCheckResourceAttr(resourceName, "metadata.key1", "value1"), resource.TestCheckResourceAttr(resourceName, "metadata.key2", "value2"), ), }, { - Config: testAccBucketObjectConfig_withMetadata(rName, "key1", "value1updated", "key3", "value3"), + Config: testAccObjectConfig_withMetadata(rName, "key1", "value1updated", "key3", "value3"), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj), + testAccCheckObjectExists(resourceName, &obj), resource.TestCheckResourceAttr(resourceName, "metadata.%", "2"), resource.TestCheckResourceAttr(resourceName, "metadata.key1", "value1updated"), resource.TestCheckResourceAttr(resourceName, "metadata.key3", "value3"), ), }, { - Config: testAccBucketObjectEmptyConfig(rName), + Config: testAccObjectEmptyConfig(rName), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj), + testAccCheckObjectExists(resourceName, &obj), resource.TestCheckResourceAttr(resourceName, "metadata.%", "0"), ), }, @@ -666,47 +666,47 @@ func TestAccS3Object_storageClass(t *testing.T) { PreCheck: func() { acctest.PreCheck(t) }, ErrorCheck: acctest.ErrorCheck(t, s3.EndpointsID), Providers: acctest.Providers, - CheckDestroy: testAccCheckBucketObjectDestroy, + CheckDestroy: testAccCheckObjectDestroy, Steps: []resource.TestStep{ { PreConfig: func() {}, - Config: testAccBucketObjectContentConfig(rName, "some_bucket_content"), + Config: testAccObjectContentConfig(rName, "some_bucket_content"), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj), + testAccCheckObjectExists(resourceName, &obj), resource.TestCheckResourceAttr(resourceName, "storage_class", "STANDARD"), - testAccCheckBucketObjectStorageClass(resourceName, "STANDARD"), + testAccCheckObjectStorageClass(resourceName, "STANDARD"), ), }, { - Config: testAccBucketObjectConfig_storageClass(rName, "REDUCED_REDUNDANCY"), + Config: testAccObjectConfig_storageClass(rName, "REDUCED_REDUNDANCY"), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj), + testAccCheckObjectExists(resourceName, &obj), resource.TestCheckResourceAttr(resourceName, "storage_class", "REDUCED_REDUNDANCY"), - testAccCheckBucketObjectStorageClass(resourceName, "REDUCED_REDUNDANCY"), + testAccCheckObjectStorageClass(resourceName, "REDUCED_REDUNDANCY"), ), }, { - Config: testAccBucketObjectConfig_storageClass(rName, "GLACIER"), + Config: testAccObjectConfig_storageClass(rName, "GLACIER"), Check: resource.ComposeTestCheckFunc( // Can't GetObject on an object in Glacier without restoring it. resource.TestCheckResourceAttr(resourceName, "storage_class", "GLACIER"), - testAccCheckBucketObjectStorageClass(resourceName, "GLACIER"), + testAccCheckObjectStorageClass(resourceName, "GLACIER"), ), }, { - Config: testAccBucketObjectConfig_storageClass(rName, "INTELLIGENT_TIERING"), + Config: testAccObjectConfig_storageClass(rName, "INTELLIGENT_TIERING"), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj), + testAccCheckObjectExists(resourceName, &obj), resource.TestCheckResourceAttr(resourceName, "storage_class", "INTELLIGENT_TIERING"), - testAccCheckBucketObjectStorageClass(resourceName, "INTELLIGENT_TIERING"), + testAccCheckObjectStorageClass(resourceName, "INTELLIGENT_TIERING"), ), }, { - Config: testAccBucketObjectConfig_storageClass(rName, "DEEP_ARCHIVE"), + Config: testAccObjectConfig_storageClass(rName, "DEEP_ARCHIVE"), Check: resource.ComposeTestCheckFunc( // Can't GetObject on an object in DEEP_ARCHIVE without restoring it. resource.TestCheckResourceAttr(resourceName, "storage_class", "DEEP_ARCHIVE"), - testAccCheckBucketObjectStorageClass(resourceName, "DEEP_ARCHIVE"), + testAccCheckObjectStorageClass(resourceName, "DEEP_ARCHIVE"), ), }, { @@ -730,14 +730,14 @@ func TestAccS3Object_tags(t *testing.T) { PreCheck: func() { acctest.PreCheck(t) }, ErrorCheck: acctest.ErrorCheck(t, s3.EndpointsID), Providers: acctest.Providers, - CheckDestroy: testAccCheckBucketObjectDestroy, + CheckDestroy: testAccCheckObjectDestroy, Steps: []resource.TestStep{ { PreConfig: func() {}, - Config: testAccBucketObjectConfig_withTags(rName, key, "stuff"), + Config: testAccObjectConfig_withTags(rName, key, "stuff"), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj1), - testAccCheckBucketObjectBody(&obj1, "stuff"), + testAccCheckObjectExists(resourceName, &obj1), + testAccCheckObjectBody(&obj1, "stuff"), resource.TestCheckResourceAttr(resourceName, "tags.%", "3"), resource.TestCheckResourceAttr(resourceName, "tags.Key1", "A@AA"), resource.TestCheckResourceAttr(resourceName, "tags.Key2", "BBB"), @@ -746,11 +746,11 @@ func TestAccS3Object_tags(t *testing.T) { }, { PreConfig: func() {}, - Config: testAccBucketObjectConfig_withUpdatedTags(rName, key, "stuff"), + Config: testAccObjectConfig_withUpdatedTags(rName, key, "stuff"), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj2), - testAccCheckBucketObjectVersionIdEquals(&obj2, &obj1), - testAccCheckBucketObjectBody(&obj2, "stuff"), + testAccCheckObjectExists(resourceName, &obj2), + testAccCheckObjectVersionIdEquals(&obj2, &obj1), + testAccCheckObjectBody(&obj2, "stuff"), resource.TestCheckResourceAttr(resourceName, "tags.%", "4"), resource.TestCheckResourceAttr(resourceName, "tags.Key2", "B@BB"), resource.TestCheckResourceAttr(resourceName, "tags.Key3", "X X"), @@ -760,21 +760,21 @@ func TestAccS3Object_tags(t *testing.T) { }, { PreConfig: func() {}, - Config: testAccBucketObjectConfig_withNoTags(rName, key, "stuff"), + Config: testAccObjectConfig_withNoTags(rName, key, "stuff"), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj3), - testAccCheckBucketObjectVersionIdEquals(&obj3, &obj2), - testAccCheckBucketObjectBody(&obj3, "stuff"), + testAccCheckObjectExists(resourceName, &obj3), + testAccCheckObjectVersionIdEquals(&obj3, &obj2), + testAccCheckObjectBody(&obj3, "stuff"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), ), }, { PreConfig: func() {}, - Config: testAccBucketObjectConfig_withTags(rName, key, "changed stuff"), + Config: testAccObjectConfig_withTags(rName, key, "changed stuff"), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj4), - testAccCheckBucketObjectVersionIdDiffers(&obj4, &obj3), - testAccCheckBucketObjectBody(&obj4, "changed stuff"), + testAccCheckObjectExists(resourceName, &obj4), + testAccCheckObjectVersionIdDiffers(&obj4, &obj3), + testAccCheckObjectBody(&obj4, "changed stuff"), resource.TestCheckResourceAttr(resourceName, "tags.%", "3"), resource.TestCheckResourceAttr(resourceName, "tags.Key1", "A@AA"), resource.TestCheckResourceAttr(resourceName, "tags.Key2", "BBB"), @@ -802,14 +802,14 @@ func TestAccS3Object_tagsLeadingSingleSlash(t *testing.T) { PreCheck: func() { acctest.PreCheck(t) }, ErrorCheck: acctest.ErrorCheck(t, s3.EndpointsID), Providers: acctest.Providers, - CheckDestroy: testAccCheckBucketObjectDestroy, + CheckDestroy: testAccCheckObjectDestroy, Steps: []resource.TestStep{ { PreConfig: func() {}, - Config: testAccBucketObjectConfig_withTags(rName, key, "stuff"), + Config: testAccObjectConfig_withTags(rName, key, "stuff"), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj1), - testAccCheckBucketObjectBody(&obj1, "stuff"), + testAccCheckObjectExists(resourceName, &obj1), + testAccCheckObjectBody(&obj1, "stuff"), resource.TestCheckResourceAttr(resourceName, "tags.%", "3"), resource.TestCheckResourceAttr(resourceName, "tags.Key1", "A@AA"), resource.TestCheckResourceAttr(resourceName, "tags.Key2", "BBB"), @@ -818,11 +818,11 @@ func TestAccS3Object_tagsLeadingSingleSlash(t *testing.T) { }, { PreConfig: func() {}, - Config: testAccBucketObjectConfig_withUpdatedTags(rName, key, "stuff"), + Config: testAccObjectConfig_withUpdatedTags(rName, key, "stuff"), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj2), - testAccCheckBucketObjectVersionIdEquals(&obj2, &obj1), - testAccCheckBucketObjectBody(&obj2, "stuff"), + testAccCheckObjectExists(resourceName, &obj2), + testAccCheckObjectVersionIdEquals(&obj2, &obj1), + testAccCheckObjectBody(&obj2, "stuff"), resource.TestCheckResourceAttr(resourceName, "tags.%", "4"), resource.TestCheckResourceAttr(resourceName, "tags.Key2", "B@BB"), resource.TestCheckResourceAttr(resourceName, "tags.Key3", "X X"), @@ -832,21 +832,21 @@ func TestAccS3Object_tagsLeadingSingleSlash(t *testing.T) { }, { PreConfig: func() {}, - Config: testAccBucketObjectConfig_withNoTags(rName, key, "stuff"), + Config: testAccObjectConfig_withNoTags(rName, key, "stuff"), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj3), - testAccCheckBucketObjectVersionIdEquals(&obj3, &obj2), - testAccCheckBucketObjectBody(&obj3, "stuff"), + testAccCheckObjectExists(resourceName, &obj3), + testAccCheckObjectVersionIdEquals(&obj3, &obj2), + testAccCheckObjectBody(&obj3, "stuff"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), ), }, { PreConfig: func() {}, - Config: testAccBucketObjectConfig_withTags(rName, key, "changed stuff"), + Config: testAccObjectConfig_withTags(rName, key, "changed stuff"), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj4), - testAccCheckBucketObjectVersionIdDiffers(&obj4, &obj3), - testAccCheckBucketObjectBody(&obj4, "changed stuff"), + testAccCheckObjectExists(resourceName, &obj4), + testAccCheckObjectVersionIdDiffers(&obj4, &obj3), + testAccCheckObjectBody(&obj4, "changed stuff"), resource.TestCheckResourceAttr(resourceName, "tags.%", "3"), resource.TestCheckResourceAttr(resourceName, "tags.Key1", "A@AA"), resource.TestCheckResourceAttr(resourceName, "tags.Key2", "BBB"), @@ -874,14 +874,14 @@ func TestAccS3Object_tagsLeadingMultipleSlashes(t *testing.T) { PreCheck: func() { acctest.PreCheck(t) }, ErrorCheck: acctest.ErrorCheck(t, s3.EndpointsID), Providers: acctest.Providers, - CheckDestroy: testAccCheckBucketObjectDestroy, + CheckDestroy: testAccCheckObjectDestroy, Steps: []resource.TestStep{ { PreConfig: func() {}, - Config: testAccBucketObjectConfig_withTags(rName, key, "stuff"), + Config: testAccObjectConfig_withTags(rName, key, "stuff"), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj1), - testAccCheckBucketObjectBody(&obj1, "stuff"), + testAccCheckObjectExists(resourceName, &obj1), + testAccCheckObjectBody(&obj1, "stuff"), resource.TestCheckResourceAttr(resourceName, "tags.%", "3"), resource.TestCheckResourceAttr(resourceName, "tags.Key1", "A@AA"), resource.TestCheckResourceAttr(resourceName, "tags.Key2", "BBB"), @@ -890,11 +890,11 @@ func TestAccS3Object_tagsLeadingMultipleSlashes(t *testing.T) { }, { PreConfig: func() {}, - Config: testAccBucketObjectConfig_withUpdatedTags(rName, key, "stuff"), + Config: testAccObjectConfig_withUpdatedTags(rName, key, "stuff"), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj2), - testAccCheckBucketObjectVersionIdEquals(&obj2, &obj1), - testAccCheckBucketObjectBody(&obj2, "stuff"), + testAccCheckObjectExists(resourceName, &obj2), + testAccCheckObjectVersionIdEquals(&obj2, &obj1), + testAccCheckObjectBody(&obj2, "stuff"), resource.TestCheckResourceAttr(resourceName, "tags.%", "4"), resource.TestCheckResourceAttr(resourceName, "tags.Key2", "B@BB"), resource.TestCheckResourceAttr(resourceName, "tags.Key3", "X X"), @@ -904,21 +904,21 @@ func TestAccS3Object_tagsLeadingMultipleSlashes(t *testing.T) { }, { PreConfig: func() {}, - Config: testAccBucketObjectConfig_withNoTags(rName, key, "stuff"), + Config: testAccObjectConfig_withNoTags(rName, key, "stuff"), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj3), - testAccCheckBucketObjectVersionIdEquals(&obj3, &obj2), - testAccCheckBucketObjectBody(&obj3, "stuff"), + testAccCheckObjectExists(resourceName, &obj3), + testAccCheckObjectVersionIdEquals(&obj3, &obj2), + testAccCheckObjectBody(&obj3, "stuff"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), ), }, { PreConfig: func() {}, - Config: testAccBucketObjectConfig_withTags(rName, key, "changed stuff"), + Config: testAccObjectConfig_withTags(rName, key, "changed stuff"), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj4), - testAccCheckBucketObjectVersionIdDiffers(&obj4, &obj3), - testAccCheckBucketObjectBody(&obj4, "changed stuff"), + testAccCheckObjectExists(resourceName, &obj4), + testAccCheckObjectVersionIdDiffers(&obj4, &obj3), + testAccCheckObjectBody(&obj4, "changed stuff"), resource.TestCheckResourceAttr(resourceName, "tags.%", "3"), resource.TestCheckResourceAttr(resourceName, "tags.Key1", "A@AA"), resource.TestCheckResourceAttr(resourceName, "tags.Key2", "BBB"), @@ -939,14 +939,14 @@ func TestAccS3Object_tagsMultipleSlashes(t *testing.T) { PreCheck: func() { acctest.PreCheck(t) }, ErrorCheck: acctest.ErrorCheck(t, s3.EndpointsID), Providers: acctest.Providers, - CheckDestroy: testAccCheckBucketObjectDestroy, + CheckDestroy: testAccCheckObjectDestroy, Steps: []resource.TestStep{ { PreConfig: func() {}, - Config: testAccBucketObjectConfig_withTags(rName, key, "stuff"), + Config: testAccObjectConfig_withTags(rName, key, "stuff"), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj1), - testAccCheckBucketObjectBody(&obj1, "stuff"), + testAccCheckObjectExists(resourceName, &obj1), + testAccCheckObjectBody(&obj1, "stuff"), resource.TestCheckResourceAttr(resourceName, "tags.%", "3"), resource.TestCheckResourceAttr(resourceName, "tags.Key1", "A@AA"), resource.TestCheckResourceAttr(resourceName, "tags.Key2", "BBB"), @@ -955,11 +955,11 @@ func TestAccS3Object_tagsMultipleSlashes(t *testing.T) { }, { PreConfig: func() {}, - Config: testAccBucketObjectConfig_withUpdatedTags(rName, key, "stuff"), + Config: testAccObjectConfig_withUpdatedTags(rName, key, "stuff"), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj2), - testAccCheckBucketObjectVersionIdEquals(&obj2, &obj1), - testAccCheckBucketObjectBody(&obj2, "stuff"), + testAccCheckObjectExists(resourceName, &obj2), + testAccCheckObjectVersionIdEquals(&obj2, &obj1), + testAccCheckObjectBody(&obj2, "stuff"), resource.TestCheckResourceAttr(resourceName, "tags.%", "4"), resource.TestCheckResourceAttr(resourceName, "tags.Key2", "B@BB"), resource.TestCheckResourceAttr(resourceName, "tags.Key3", "X X"), @@ -969,21 +969,21 @@ func TestAccS3Object_tagsMultipleSlashes(t *testing.T) { }, { PreConfig: func() {}, - Config: testAccBucketObjectConfig_withNoTags(rName, key, "stuff"), + Config: testAccObjectConfig_withNoTags(rName, key, "stuff"), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj3), - testAccCheckBucketObjectVersionIdEquals(&obj3, &obj2), - testAccCheckBucketObjectBody(&obj3, "stuff"), + testAccCheckObjectExists(resourceName, &obj3), + testAccCheckObjectVersionIdEquals(&obj3, &obj2), + testAccCheckObjectBody(&obj3, "stuff"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), ), }, { PreConfig: func() {}, - Config: testAccBucketObjectConfig_withTags(rName, key, "changed stuff"), + Config: testAccObjectConfig_withTags(rName, key, "changed stuff"), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj4), - testAccCheckBucketObjectVersionIdDiffers(&obj4, &obj3), - testAccCheckBucketObjectBody(&obj4, "changed stuff"), + testAccCheckObjectExists(resourceName, &obj4), + testAccCheckObjectVersionIdDiffers(&obj4, &obj3), + testAccCheckObjectBody(&obj4, "changed stuff"), resource.TestCheckResourceAttr(resourceName, "tags.%", "3"), resource.TestCheckResourceAttr(resourceName, "tags.Key1", "A@AA"), resource.TestCheckResourceAttr(resourceName, "tags.Key2", "BBB"), @@ -1003,24 +1003,24 @@ func TestAccS3Object_objectLockLegalHoldStartWithNone(t *testing.T) { PreCheck: func() { acctest.PreCheck(t) }, ErrorCheck: acctest.ErrorCheck(t, s3.EndpointsID), Providers: acctest.Providers, - CheckDestroy: testAccCheckBucketObjectDestroy, + CheckDestroy: testAccCheckObjectDestroy, Steps: []resource.TestStep{ { - Config: testAccBucketObjectConfig_noObjectLockLegalHold(rName, "stuff"), + Config: testAccObjectConfig_noObjectLockLegalHold(rName, "stuff"), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj1), - testAccCheckBucketObjectBody(&obj1, "stuff"), + testAccCheckObjectExists(resourceName, &obj1), + testAccCheckObjectBody(&obj1, "stuff"), resource.TestCheckResourceAttr(resourceName, "object_lock_legal_hold_status", ""), resource.TestCheckResourceAttr(resourceName, "object_lock_mode", ""), resource.TestCheckResourceAttr(resourceName, "object_lock_retain_until_date", ""), ), }, { - Config: testAccBucketObjectConfig_withObjectLockLegalHold(rName, "stuff", "ON"), + Config: testAccObjectConfig_withObjectLockLegalHold(rName, "stuff", "ON"), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj2), - testAccCheckBucketObjectVersionIdEquals(&obj2, &obj1), - testAccCheckBucketObjectBody(&obj2, "stuff"), + testAccCheckObjectExists(resourceName, &obj2), + testAccCheckObjectVersionIdEquals(&obj2, &obj1), + testAccCheckObjectBody(&obj2, "stuff"), resource.TestCheckResourceAttr(resourceName, "object_lock_legal_hold_status", "ON"), resource.TestCheckResourceAttr(resourceName, "object_lock_mode", ""), resource.TestCheckResourceAttr(resourceName, "object_lock_retain_until_date", ""), @@ -1028,11 +1028,11 @@ func TestAccS3Object_objectLockLegalHoldStartWithNone(t *testing.T) { }, // Remove legal hold but create a new object version to test force_destroy { - Config: testAccBucketObjectConfig_withObjectLockLegalHold(rName, "changed stuff", "OFF"), + Config: testAccObjectConfig_withObjectLockLegalHold(rName, "changed stuff", "OFF"), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj3), - testAccCheckBucketObjectVersionIdDiffers(&obj3, &obj2), - testAccCheckBucketObjectBody(&obj3, "changed stuff"), + testAccCheckObjectExists(resourceName, &obj3), + testAccCheckObjectVersionIdDiffers(&obj3, &obj2), + testAccCheckObjectBody(&obj3, "changed stuff"), resource.TestCheckResourceAttr(resourceName, "object_lock_legal_hold_status", "OFF"), resource.TestCheckResourceAttr(resourceName, "object_lock_mode", ""), resource.TestCheckResourceAttr(resourceName, "object_lock_retain_until_date", ""), @@ -1051,24 +1051,24 @@ func TestAccS3Object_objectLockLegalHoldStartWithOn(t *testing.T) { PreCheck: func() { acctest.PreCheck(t) }, ErrorCheck: acctest.ErrorCheck(t, s3.EndpointsID), Providers: acctest.Providers, - CheckDestroy: testAccCheckBucketObjectDestroy, + CheckDestroy: testAccCheckObjectDestroy, Steps: []resource.TestStep{ { - Config: testAccBucketObjectConfig_withObjectLockLegalHold(rName, "stuff", "ON"), + Config: testAccObjectConfig_withObjectLockLegalHold(rName, "stuff", "ON"), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj1), - testAccCheckBucketObjectBody(&obj1, "stuff"), + testAccCheckObjectExists(resourceName, &obj1), + testAccCheckObjectBody(&obj1, "stuff"), resource.TestCheckResourceAttr(resourceName, "object_lock_legal_hold_status", "ON"), resource.TestCheckResourceAttr(resourceName, "object_lock_mode", ""), resource.TestCheckResourceAttr(resourceName, "object_lock_retain_until_date", ""), ), }, { - Config: testAccBucketObjectConfig_withObjectLockLegalHold(rName, "stuff", "OFF"), + Config: testAccObjectConfig_withObjectLockLegalHold(rName, "stuff", "OFF"), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj2), - testAccCheckBucketObjectVersionIdEquals(&obj2, &obj1), - testAccCheckBucketObjectBody(&obj2, "stuff"), + testAccCheckObjectExists(resourceName, &obj2), + testAccCheckObjectVersionIdEquals(&obj2, &obj1), + testAccCheckObjectBody(&obj2, "stuff"), resource.TestCheckResourceAttr(resourceName, "object_lock_legal_hold_status", "OFF"), resource.TestCheckResourceAttr(resourceName, "object_lock_mode", ""), resource.TestCheckResourceAttr(resourceName, "object_lock_retain_until_date", ""), @@ -1088,24 +1088,24 @@ func TestAccS3Object_objectLockRetentionStartWithNone(t *testing.T) { PreCheck: func() { acctest.PreCheck(t) }, ErrorCheck: acctest.ErrorCheck(t, s3.EndpointsID), Providers: acctest.Providers, - CheckDestroy: testAccCheckBucketObjectDestroy, + CheckDestroy: testAccCheckObjectDestroy, Steps: []resource.TestStep{ { - Config: testAccBucketObjectConfig_noObjectLockRetention(rName, "stuff"), + Config: testAccObjectConfig_noObjectLockRetention(rName, "stuff"), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj1), - testAccCheckBucketObjectBody(&obj1, "stuff"), + testAccCheckObjectExists(resourceName, &obj1), + testAccCheckObjectBody(&obj1, "stuff"), resource.TestCheckResourceAttr(resourceName, "object_lock_legal_hold_status", ""), resource.TestCheckResourceAttr(resourceName, "object_lock_mode", ""), resource.TestCheckResourceAttr(resourceName, "object_lock_retain_until_date", ""), ), }, { - Config: testAccBucketObjectConfig_withObjectLockRetention(rName, "stuff", retainUntilDate), + Config: testAccObjectConfig_withObjectLockRetention(rName, "stuff", retainUntilDate), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj2), - testAccCheckBucketObjectVersionIdEquals(&obj2, &obj1), - testAccCheckBucketObjectBody(&obj2, "stuff"), + testAccCheckObjectExists(resourceName, &obj2), + testAccCheckObjectVersionIdEquals(&obj2, &obj1), + testAccCheckObjectBody(&obj2, "stuff"), resource.TestCheckResourceAttr(resourceName, "object_lock_legal_hold_status", ""), resource.TestCheckResourceAttr(resourceName, "object_lock_mode", "GOVERNANCE"), resource.TestCheckResourceAttr(resourceName, "object_lock_retain_until_date", retainUntilDate), @@ -1113,11 +1113,11 @@ func TestAccS3Object_objectLockRetentionStartWithNone(t *testing.T) { }, // Remove retention period but create a new object version to test force_destroy { - Config: testAccBucketObjectConfig_noObjectLockRetention(rName, "changed stuff"), + Config: testAccObjectConfig_noObjectLockRetention(rName, "changed stuff"), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj3), - testAccCheckBucketObjectVersionIdDiffers(&obj3, &obj2), - testAccCheckBucketObjectBody(&obj3, "changed stuff"), + testAccCheckObjectExists(resourceName, &obj3), + testAccCheckObjectVersionIdDiffers(&obj3, &obj2), + testAccCheckObjectBody(&obj3, "changed stuff"), resource.TestCheckResourceAttr(resourceName, "object_lock_legal_hold_status", ""), resource.TestCheckResourceAttr(resourceName, "object_lock_mode", ""), resource.TestCheckResourceAttr(resourceName, "object_lock_retain_until_date", ""), @@ -1139,46 +1139,46 @@ func TestAccS3Object_objectLockRetentionStartWithSet(t *testing.T) { PreCheck: func() { acctest.PreCheck(t) }, ErrorCheck: acctest.ErrorCheck(t, s3.EndpointsID), Providers: acctest.Providers, - CheckDestroy: testAccCheckBucketObjectDestroy, + CheckDestroy: testAccCheckObjectDestroy, Steps: []resource.TestStep{ { - Config: testAccBucketObjectConfig_withObjectLockRetention(rName, "stuff", retainUntilDate1), + Config: testAccObjectConfig_withObjectLockRetention(rName, "stuff", retainUntilDate1), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj1), - testAccCheckBucketObjectBody(&obj1, "stuff"), + testAccCheckObjectExists(resourceName, &obj1), + testAccCheckObjectBody(&obj1, "stuff"), resource.TestCheckResourceAttr(resourceName, "object_lock_legal_hold_status", ""), resource.TestCheckResourceAttr(resourceName, "object_lock_mode", "GOVERNANCE"), resource.TestCheckResourceAttr(resourceName, "object_lock_retain_until_date", retainUntilDate1), ), }, { - Config: testAccBucketObjectConfig_withObjectLockRetention(rName, "stuff", retainUntilDate2), + Config: testAccObjectConfig_withObjectLockRetention(rName, "stuff", retainUntilDate2), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj2), - testAccCheckBucketObjectVersionIdEquals(&obj2, &obj1), - testAccCheckBucketObjectBody(&obj2, "stuff"), + testAccCheckObjectExists(resourceName, &obj2), + testAccCheckObjectVersionIdEquals(&obj2, &obj1), + testAccCheckObjectBody(&obj2, "stuff"), resource.TestCheckResourceAttr(resourceName, "object_lock_legal_hold_status", ""), resource.TestCheckResourceAttr(resourceName, "object_lock_mode", "GOVERNANCE"), resource.TestCheckResourceAttr(resourceName, "object_lock_retain_until_date", retainUntilDate2), ), }, { - Config: testAccBucketObjectConfig_withObjectLockRetention(rName, "stuff", retainUntilDate3), + Config: testAccObjectConfig_withObjectLockRetention(rName, "stuff", retainUntilDate3), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj3), - testAccCheckBucketObjectVersionIdEquals(&obj3, &obj2), - testAccCheckBucketObjectBody(&obj3, "stuff"), + testAccCheckObjectExists(resourceName, &obj3), + testAccCheckObjectVersionIdEquals(&obj3, &obj2), + testAccCheckObjectBody(&obj3, "stuff"), resource.TestCheckResourceAttr(resourceName, "object_lock_legal_hold_status", ""), resource.TestCheckResourceAttr(resourceName, "object_lock_mode", "GOVERNANCE"), resource.TestCheckResourceAttr(resourceName, "object_lock_retain_until_date", retainUntilDate3), ), }, { - Config: testAccBucketObjectConfig_noObjectLockRetention(rName, "stuff"), + Config: testAccObjectConfig_noObjectLockRetention(rName, "stuff"), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj4), - testAccCheckBucketObjectVersionIdEquals(&obj4, &obj3), - testAccCheckBucketObjectBody(&obj4, "stuff"), + testAccCheckObjectExists(resourceName, &obj4), + testAccCheckObjectVersionIdEquals(&obj4, &obj3), + testAccCheckObjectBody(&obj4, "stuff"), resource.TestCheckResourceAttr(resourceName, "object_lock_legal_hold_status", ""), resource.TestCheckResourceAttr(resourceName, "object_lock_mode", ""), resource.TestCheckResourceAttr(resourceName, "object_lock_retain_until_date", ""), @@ -1197,13 +1197,13 @@ func TestAccS3Object_objectBucketKeyEnabled(t *testing.T) { PreCheck: func() { acctest.PreCheck(t) }, ErrorCheck: acctest.ErrorCheck(t, s3.EndpointsID), Providers: acctest.Providers, - CheckDestroy: testAccCheckBucketObjectDestroy, + CheckDestroy: testAccCheckObjectDestroy, Steps: []resource.TestStep{ { - Config: testAccBucketObjectConfig_objectBucketKeyEnabled(rName, "stuff"), + Config: testAccObjectConfig_objectBucketKeyEnabled(rName, "stuff"), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj), - testAccCheckBucketObjectBody(&obj, "stuff"), + testAccCheckObjectExists(resourceName, &obj), + testAccCheckObjectBody(&obj, "stuff"), resource.TestCheckResourceAttr(resourceName, "bucket_key_enabled", "true"), ), }, @@ -1220,13 +1220,13 @@ func TestAccS3Object_bucketBucketKeyEnabled(t *testing.T) { PreCheck: func() { acctest.PreCheck(t) }, ErrorCheck: acctest.ErrorCheck(t, s3.EndpointsID), Providers: acctest.Providers, - CheckDestroy: testAccCheckBucketObjectDestroy, + CheckDestroy: testAccCheckObjectDestroy, Steps: []resource.TestStep{ { - Config: testAccBucketObjectConfig_bucketBucketKeyEnabled(rName, "stuff"), + Config: testAccObjectConfig_bucketBucketKeyEnabled(rName, "stuff"), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj), - testAccCheckBucketObjectBody(&obj, "stuff"), + testAccCheckObjectExists(resourceName, &obj), + testAccCheckObjectBody(&obj, "stuff"), resource.TestCheckResourceAttr(resourceName, "bucket_key_enabled", "true"), ), }, @@ -1243,13 +1243,13 @@ func TestAccS3Object_defaultBucketSSE(t *testing.T) { PreCheck: func() { acctest.PreCheck(t) }, ErrorCheck: acctest.ErrorCheck(t, s3.EndpointsID), Providers: acctest.Providers, - CheckDestroy: testAccCheckBucketObjectDestroy, + CheckDestroy: testAccCheckObjectDestroy, Steps: []resource.TestStep{ { - Config: testAccBucketObjectConfig_defaultBucketSSE(rName, "stuff"), + Config: testAccObjectConfig_defaultBucketSSE(rName, "stuff"), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj1), - testAccCheckBucketObjectBody(&obj1, "stuff"), + testAccCheckObjectExists(resourceName, &obj1), + testAccCheckObjectBody(&obj1, "stuff"), ), }, }, @@ -1267,19 +1267,19 @@ func TestAccS3Object_ignoreTags(t *testing.T) { PreCheck: func() { acctest.PreCheck(t) }, ErrorCheck: acctest.ErrorCheck(t, s3.EndpointsID), ProviderFactories: acctest.FactoriesInternal(&providers), - CheckDestroy: testAccCheckBucketObjectDestroy, + CheckDestroy: testAccCheckObjectDestroy, Steps: []resource.TestStep{ { PreConfig: func() {}, Config: acctest.ConfigCompose( acctest.ConfigIgnoreTagsKeyPrefixes1("ignorekey"), - testAccBucketObjectConfig_withNoTags(rName, key, "stuff")), + testAccObjectConfig_withNoTags(rName, key, "stuff")), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj), - testAccCheckBucketObjectBody(&obj, "stuff"), - testAccCheckBucketObjectUpdateTags(resourceName, nil, map[string]string{"ignorekey1": "ignorevalue1"}), + testAccCheckObjectExists(resourceName, &obj), + testAccCheckObjectBody(&obj, "stuff"), + testAccCheckObjectUpdateTags(resourceName, nil, map[string]string{"ignorekey1": "ignorevalue1"}), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), - testAccCheckBucketObjectCheckTags(resourceName, map[string]string{ + testAccCheckObjectCheckTags(resourceName, map[string]string{ "ignorekey1": "ignorevalue1", }), ), @@ -1288,15 +1288,15 @@ func TestAccS3Object_ignoreTags(t *testing.T) { PreConfig: func() {}, Config: acctest.ConfigCompose( acctest.ConfigIgnoreTagsKeyPrefixes1("ignorekey"), - testAccBucketObjectConfig_withTags(rName, key, "stuff")), + testAccObjectConfig_withTags(rName, key, "stuff")), Check: resource.ComposeTestCheckFunc( - testAccCheckBucketObjectExists(resourceName, &obj), - testAccCheckBucketObjectBody(&obj, "stuff"), + testAccCheckObjectExists(resourceName, &obj), + testAccCheckObjectBody(&obj, "stuff"), resource.TestCheckResourceAttr(resourceName, "tags.%", "3"), resource.TestCheckResourceAttr(resourceName, "tags.Key1", "A@AA"), resource.TestCheckResourceAttr(resourceName, "tags.Key2", "BBB"), resource.TestCheckResourceAttr(resourceName, "tags.Key3", "CCC"), - testAccCheckBucketObjectCheckTags(resourceName, map[string]string{ + testAccCheckObjectCheckTags(resourceName, map[string]string{ "ignorekey1": "ignorevalue1", "Key1": "A@AA", "Key2": "BBB", @@ -1308,7 +1308,7 @@ func TestAccS3Object_ignoreTags(t *testing.T) { }) } -func testAccCheckBucketObjectVersionIdDiffers(first, second *s3.GetObjectOutput) resource.TestCheckFunc { +func testAccCheckObjectVersionIdDiffers(first, second *s3.GetObjectOutput) resource.TestCheckFunc { return func(s *terraform.State) error { if first.VersionId == nil { return fmt.Errorf("Expected first object to have VersionId: %s", first) @@ -1325,7 +1325,7 @@ func testAccCheckBucketObjectVersionIdDiffers(first, second *s3.GetObjectOutput) } } -func testAccCheckBucketObjectVersionIdEquals(first, second *s3.GetObjectOutput) resource.TestCheckFunc { +func testAccCheckObjectVersionIdEquals(first, second *s3.GetObjectOutput) resource.TestCheckFunc { return func(s *terraform.State) error { if first.VersionId == nil { return fmt.Errorf("Expected first object to have VersionId: %s", first) @@ -1342,7 +1342,7 @@ func testAccCheckBucketObjectVersionIdEquals(first, second *s3.GetObjectOutput) } } -func testAccCheckBucketObjectDestroy(s *terraform.State) error { +func testAccCheckObjectDestroy(s *terraform.State) error { conn := acctest.Provider.Meta().(*conns.AWSClient).S3Conn for _, rs := range s.RootModule().Resources { @@ -1363,7 +1363,7 @@ func testAccCheckBucketObjectDestroy(s *terraform.State) error { return nil } -func testAccCheckBucketObjectExists(n string, obj *s3.GetObjectOutput) resource.TestCheckFunc { +func testAccCheckObjectExists(n string, obj *s3.GetObjectOutput) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] if !ok { @@ -1414,7 +1414,7 @@ func testAccCheckBucketObjectExists(n string, obj *s3.GetObjectOutput) resource. } } -func testAccCheckBucketObjectBody(obj *s3.GetObjectOutput, want string) resource.TestCheckFunc { +func testAccCheckObjectBody(obj *s3.GetObjectOutput, want string) resource.TestCheckFunc { return func(s *terraform.State) error { body, err := io.ReadAll(obj.Body) if err != nil { @@ -1430,7 +1430,7 @@ func testAccCheckBucketObjectBody(obj *s3.GetObjectOutput, want string) resource } } -func testAccCheckBucketObjectACL(n string, expectedPerms []string) resource.TestCheckFunc { +func testAccCheckObjectACL(n string, expectedPerms []string) resource.TestCheckFunc { return func(s *terraform.State) error { rs := s.RootModule().Resources[n] conn := acctest.Provider.Meta().(*conns.AWSClient).S3Conn @@ -1458,7 +1458,7 @@ func testAccCheckBucketObjectACL(n string, expectedPerms []string) resource.Test } } -func testAccCheckBucketObjectStorageClass(n, expectedClass string) resource.TestCheckFunc { +func testAccCheckObjectStorageClass(n, expectedClass string) resource.TestCheckFunc { return func(s *terraform.State) error { rs := s.RootModule().Resources[n] conn := acctest.Provider.Meta().(*conns.AWSClient).S3Conn @@ -1488,7 +1488,7 @@ func testAccCheckBucketObjectStorageClass(n, expectedClass string) resource.Test } } -func testAccCheckBucketObjectSSE(n, expectedSSE string) resource.TestCheckFunc { +func testAccCheckObjectSSE(n, expectedSSE string) resource.TestCheckFunc { return func(s *terraform.State) error { rs := s.RootModule().Resources[n] conn := acctest.Provider.Meta().(*conns.AWSClient).S3Conn @@ -1516,7 +1516,7 @@ func testAccCheckBucketObjectSSE(n, expectedSSE string) resource.TestCheckFunc { } } -func testAccBucketObjectCreateTempFile(t *testing.T, data string) string { +func testAccObjectCreateTempFile(t *testing.T, data string) string { tmpFile, err := os.CreateTemp("", "tf-acc-s3-obj") if err != nil { t.Fatal(err) @@ -1532,7 +1532,7 @@ func testAccBucketObjectCreateTempFile(t *testing.T, data string) string { return filename } -func testAccCheckBucketObjectUpdateTags(n string, oldTags, newTags map[string]string) resource.TestCheckFunc { +func testAccCheckObjectUpdateTags(n string, oldTags, newTags map[string]string) resource.TestCheckFunc { return func(s *terraform.State) error { rs := s.RootModule().Resources[n] conn := acctest.Provider.Meta().(*conns.AWSClient).S3Conn @@ -1541,7 +1541,7 @@ func testAccCheckBucketObjectUpdateTags(n string, oldTags, newTags map[string]st } } -func testAccCheckBucketObjectCheckTags(n string, expectedTags map[string]string) resource.TestCheckFunc { +func testAccCheckObjectCheckTags(n string, expectedTags map[string]string) resource.TestCheckFunc { return func(s *terraform.State) error { rs := s.RootModule().Resources[n] conn := acctest.Provider.Meta().(*conns.AWSClient).S3Conn @@ -1560,7 +1560,7 @@ func testAccCheckBucketObjectCheckTags(n string, expectedTags map[string]string) } } -func testAccBucketObjectBasicConfig(bucket, key string) string { +func testAccObjectBasicConfig(bucket, key string) string { return fmt.Sprintf(` resource "aws_s3_object" "object" { bucket = %[1]q @@ -1569,7 +1569,7 @@ resource "aws_s3_object" "object" { `, bucket, key) } -func testAccBucketObjectEmptyConfig(rName string) string { +func testAccObjectEmptyConfig(rName string) string { return fmt.Sprintf(` resource "aws_s3_bucket" "test" { bucket = %[1]q @@ -1582,7 +1582,7 @@ resource "aws_s3_object" "object" { `, rName) } -func testAccBucketObjectSourceConfig(rName string, source string) string { +func testAccObjectSourceConfig(rName string, source string) string { return fmt.Sprintf(` resource "aws_s3_bucket" "test" { bucket = %[1]q @@ -1597,7 +1597,7 @@ resource "aws_s3_object" "object" { `, rName, source) } -func testAccBucketObjectConfig_withContentCharacteristics(rName string, source string) string { +func testAccObjectConfig_withContentCharacteristics(rName string, source string) string { return fmt.Sprintf(` resource "aws_s3_bucket" "test" { bucket = %[1]q @@ -1614,7 +1614,7 @@ resource "aws_s3_object" "object" { `, rName, source) } -func testAccBucketObjectContentConfig(rName string, content string) string { +func testAccObjectContentConfig(rName string, content string) string { return fmt.Sprintf(` resource "aws_s3_bucket" "test" { bucket = %[1]q @@ -1628,7 +1628,7 @@ resource "aws_s3_object" "object" { `, rName, content) } -func testAccBucketObjectEtagEncryption(rName string, source string) string { +func testAccObjectEtagEncryption(rName string, source string) string { return fmt.Sprintf(` resource "aws_s3_bucket" "test" { bucket = %[1]q @@ -1644,7 +1644,7 @@ resource "aws_s3_object" "object" { `, rName, source) } -func testAccBucketObjectContentBase64Config(rName string, contentBase64 string) string { +func testAccObjectContentBase64Config(rName string, contentBase64 string) string { return fmt.Sprintf(` resource "aws_s3_bucket" "test" { bucket = %[1]q @@ -1658,7 +1658,7 @@ resource "aws_s3_object" "object" { `, rName, contentBase64) } -func testAccBucketObjectConfig_sourceHashTrigger(rName string, source string) string { +func testAccObjectConfig_sourceHashTrigger(rName string, source string) string { return fmt.Sprintf(` resource "aws_s3_bucket" "test" { bucket = %[1]q @@ -1673,7 +1673,7 @@ resource "aws_s3_object" "object" { `, rName, source) } -func testAccBucketObjectConfig_updateable(rName string, bucketVersioning bool, source string) string { +func testAccObjectConfig_updateable(rName string, bucketVersioning bool, source string) string { return fmt.Sprintf(` resource "aws_s3_bucket" "object_bucket_3" { bucket = %[1]q @@ -1692,7 +1692,7 @@ resource "aws_s3_object" "object" { `, rName, bucketVersioning, source) } -func testAccBucketObjectConfig_updateableViaAccessPoint(rName string, bucketVersioning bool, source string) string { +func testAccObjectConfig_updateableViaAccessPoint(rName string, bucketVersioning bool, source string) string { return fmt.Sprintf(` resource "aws_s3_bucket" "test" { bucket = %[1]q @@ -1716,7 +1716,7 @@ resource "aws_s3_object" "test" { `, rName, bucketVersioning, source) } -func testAccBucketObjectConfig_withKMSID(rName string, source string) string { +func testAccObjectConfig_withKMSID(rName string, source string) string { return fmt.Sprintf(` resource "aws_kms_key" "kms_key_1" {} @@ -1733,7 +1733,7 @@ resource "aws_s3_object" "object" { `, rName, source) } -func testAccBucketObjectConfig_withSSE(rName string, source string) string { +func testAccObjectConfig_withSSE(rName string, source string) string { return fmt.Sprintf(` resource "aws_s3_bucket" "test" { bucket = %[1]q @@ -1748,7 +1748,7 @@ resource "aws_s3_object" "object" { `, rName, source) } -func testAccBucketObjectConfig_acl(rName string, content, acl string) string { +func testAccObjectConfig_acl(rName string, content, acl string) string { return fmt.Sprintf(` resource "aws_s3_bucket" "test" { bucket = %[1]q @@ -1767,7 +1767,7 @@ resource "aws_s3_object" "object" { `, rName, content, acl) } -func testAccBucketObjectConfig_storageClass(rName string, storage_class string) string { +func testAccObjectConfig_storageClass(rName string, storage_class string) string { return fmt.Sprintf(` resource "aws_s3_bucket" "test" { bucket = %[1]q @@ -1782,7 +1782,7 @@ resource "aws_s3_object" "object" { `, rName, storage_class) } -func testAccBucketObjectConfig_withTags(rName, key, content string) string { +func testAccObjectConfig_withTags(rName, key, content string) string { return fmt.Sprintf(` resource "aws_s3_bucket" "test" { bucket = %[1]q @@ -1806,7 +1806,7 @@ resource "aws_s3_object" "object" { `, rName, key, content) } -func testAccBucketObjectConfig_withUpdatedTags(rName, key, content string) string { +func testAccObjectConfig_withUpdatedTags(rName, key, content string) string { return fmt.Sprintf(` resource "aws_s3_bucket" "test" { bucket = %[1]q @@ -1831,7 +1831,7 @@ resource "aws_s3_object" "object" { `, rName, key, content) } -func testAccBucketObjectConfig_withNoTags(rName, key, content string) string { +func testAccObjectConfig_withNoTags(rName, key, content string) string { return fmt.Sprintf(` resource "aws_s3_bucket" "test" { bucket = %[1]q @@ -1849,7 +1849,7 @@ resource "aws_s3_object" "object" { `, rName, key, content) } -func testAccBucketObjectConfig_withMetadata(rName string, metadataKey1, metadataValue1, metadataKey2, metadataValue2 string) string { +func testAccObjectConfig_withMetadata(rName string, metadataKey1, metadataValue1, metadataKey2, metadataValue2 string) string { return fmt.Sprintf(` resource "aws_s3_bucket" "test" { bucket = %[1]q @@ -1867,7 +1867,7 @@ resource "aws_s3_object" "object" { `, rName, metadataKey1, metadataValue1, metadataKey2, metadataValue2) } -func testAccBucketObjectConfig_noObjectLockLegalHold(rName string, content string) string { +func testAccObjectConfig_noObjectLockLegalHold(rName string, content string) string { return fmt.Sprintf(` resource "aws_s3_bucket" "test" { bucket = %[1]q @@ -1890,7 +1890,7 @@ resource "aws_s3_object" "object" { `, rName, content) } -func testAccBucketObjectConfig_withObjectLockLegalHold(rName string, content, legalHoldStatus string) string { +func testAccObjectConfig_withObjectLockLegalHold(rName string, content, legalHoldStatus string) string { return fmt.Sprintf(` resource "aws_s3_bucket" "test" { bucket = %[1]q @@ -1914,7 +1914,7 @@ resource "aws_s3_object" "object" { `, rName, content, legalHoldStatus) } -func testAccBucketObjectConfig_noObjectLockRetention(rName string, content string) string { +func testAccObjectConfig_noObjectLockRetention(rName string, content string) string { return fmt.Sprintf(` resource "aws_s3_bucket" "test" { bucket = %[1]q @@ -1937,7 +1937,7 @@ resource "aws_s3_object" "object" { `, rName, content) } -func testAccBucketObjectConfig_withObjectLockRetention(rName string, content, retainUntilDate string) string { +func testAccObjectConfig_withObjectLockRetention(rName string, content, retainUntilDate string) string { return fmt.Sprintf(` resource "aws_s3_bucket" "test" { bucket = %[1]q @@ -1962,7 +1962,7 @@ resource "aws_s3_object" "object" { `, rName, content, retainUntilDate) } -func testAccBucketObjectConfig_nonVersioned(rName string, source string) string { +func testAccObjectConfig_nonVersioned(rName string, source string) string { policy := `{ "Version": "2012-10-17", "Statement": [ @@ -1998,7 +1998,7 @@ resource "aws_s3_object" "object" { `, rName, source) } -func testAccBucketObjectConfig_objectBucketKeyEnabled(rName string, content string) string { +func testAccObjectConfig_objectBucketKeyEnabled(rName string, content string) string { return fmt.Sprintf(` resource "aws_kms_key" "test" { description = "Encrypts test bucket objects" @@ -2019,7 +2019,7 @@ resource "aws_s3_object" "object" { `, rName, content) } -func testAccBucketObjectConfig_bucketBucketKeyEnabled(rName string, content string) string { +func testAccObjectConfig_bucketBucketKeyEnabled(rName string, content string) string { return fmt.Sprintf(` resource "aws_kms_key" "test" { description = "Encrypts test bucket objects" @@ -2048,7 +2048,7 @@ resource "aws_s3_object" "object" { `, rName, content) } -func testAccBucketObjectConfig_defaultBucketSSE(rName string, content string) string { +func testAccObjectConfig_defaultBucketSSE(rName string, content string) string { return fmt.Sprintf(` resource "aws_kms_key" "test" { description = "Encrypts test bucket objects" diff --git a/internal/service/s3/sweep.go b/internal/service/s3/sweep.go index a0d255169c2..18e0e8043a8 100644 --- a/internal/service/s3/sweep.go +++ b/internal/service/s3/sweep.go @@ -24,7 +24,7 @@ import ( func init() { resource.AddTestSweepers("aws_s3_object", &resource.Sweeper{ Name: "aws_s3_object", - F: sweepBucketObjects, + F: sweepObjects, }) resource.AddTestSweepers("aws_s3_bucket", &resource.Sweeper{ @@ -38,7 +38,7 @@ func init() { }) } -func sweepBucketObjects(region string) error { +func sweepObjects(region string) error { client, err := sweep.SharedRegionalSweepClient(region) if err != nil { return fmt.Errorf("error getting client: %s", err) From e375ecd56164111378a5c494af850ce6188d230c Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Mon, 31 Jan 2022 12:40:39 -0500 Subject: [PATCH 15/17] Update sweeper --- internal/service/s3/sweep.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/service/s3/sweep.go b/internal/service/s3/sweep.go index 18e0e8043a8..7d4289bc336 100644 --- a/internal/service/s3/sweep.go +++ b/internal/service/s3/sweep.go @@ -93,7 +93,7 @@ func sweepObjects(region string) error { continue } - objectLockEnabled, err := bucketObjectLockEnabled(conn, bucketName) + objectLockEnabled, err := objectLockEnabled(conn, bucketName) if err != nil { log.Printf("[ERROR] Error getting S3 Bucket (%s) Object Lock: %s", bucketName, err) @@ -217,7 +217,7 @@ func bucketRegion(conn *s3.S3, bucket string) (string, error) { return region, nil } -func bucketObjectLockEnabled(conn *s3.S3, bucket string) (bool, error) { +func objectLockEnabled(conn *s3.S3, bucket string) (bool, error) { input := &s3.GetObjectLockConfigurationInput{ Bucket: aws.String(bucket), } From aeeba0efdbd0b7d856a0df655a16eda95594d795 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Mon, 31 Jan 2022 12:43:47 -0500 Subject: [PATCH 16/17] Update miscellaneous --- .semgrep.yml | 2 +- internal/service/s3/object.go | 4 ++-- internal/service/s3/object_copy.go | 2 +- internal/service/s3/object_copy_test.go | 4 ++-- internal/service/s3/object_test.go | 6 +++--- website/docs/r/s3_bucket.html.markdown | 2 +- website/docs/r/signer_signing_job.html.markdown | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.semgrep.yml b/.semgrep.yml index b9b3814753c..076d19b86e9 100644 --- a/.semgrep.yml +++ b/.semgrep.yml @@ -568,7 +568,7 @@ rules: - internal/service/mq/forge_test.go - internal/service/route53/sweep.go - internal/service/s3/bucket_test.go - - internal/service/s3/bucket_object_test.go + - internal/service/s3/object_test.go - internal/service/storagegateway/cached_iscsi_volume.go - internal/service/storagegateway/cached_iscsi_volume_test.go - internal/service/storagegateway/stored_iscsi_volume_test.go diff --git a/internal/service/s3/object.go b/internal/service/s3/object.go index 65c9ba7df2d..c9ea297dd73 100644 --- a/internal/service/s3/object.go +++ b/internal/service/s3/object.go @@ -262,7 +262,7 @@ func resourceObjectRead(d *schema.ResourceData, meta interface{}) error { d.Set("object_lock_retain_until_date", flattenS3ObjectDate(resp.ObjectLockRetainUntilDate)) if err := resourceObjectSetKMS(d, meta, resp.SSEKMSKeyId); err != nil { - return fmt.Errorf("bucket object KMS: %w", err) + return fmt.Errorf("object KMS: %w", err) } // See https://forums.aws.amazon.com/thread.jspa?threadID=44003 @@ -749,7 +749,7 @@ func DeleteAllObjectVersions(conn *s3.S3, bucketName, key string, force, ignoreO return nil } -// deleteS3ObjectVersion deletes a specific bucket object version. +// deleteS3ObjectVersion deletes a specific object version. // Set force to true to override any S3 object lock protections. func deleteS3ObjectVersion(conn *s3.S3, b, k, v string, force bool) error { input := &s3.DeleteObjectInput{ diff --git a/internal/service/s3/object_copy.go b/internal/service/s3/object_copy.go index df3a256345a..e010d45731a 100644 --- a/internal/service/s3/object_copy.go +++ b/internal/service/s3/object_copy.go @@ -350,7 +350,7 @@ func resourceObjectCopyRead(d *schema.ResourceData, meta interface{}) error { d.Set("object_lock_retain_until_date", flattenS3ObjectDate(resp.ObjectLockRetainUntilDate)) if err := resourceObjectSetKMS(d, meta, resp.SSEKMSKeyId); err != nil { - return fmt.Errorf("bucket object KMS: %w", err) + return fmt.Errorf("object KMS: %w", err) } // See https://forums.aws.amazon.com/thread.jspa?threadID=44003 diff --git a/internal/service/s3/object_copy_test.go b/internal/service/s3/object_copy_test.go index 5b17a595870..73f4efb790d 100644 --- a/internal/service/s3/object_copy_test.go +++ b/internal/service/s3/object_copy_test.go @@ -163,7 +163,7 @@ resource "aws_s3_object_copy" "test" { func testAccObjectCopyConfig_BucketKeyEnabled_Bucket(rName string) string { return fmt.Sprintf(` resource "aws_kms_key" "test" { - description = "Encrypts test bucket objects" + description = "Encrypts test objects" deletion_window_in_days = 7 } @@ -202,7 +202,7 @@ resource "aws_s3_object_copy" "test" { func testAccObjectCopyConfig_BucketKeyEnabled_Object(rName string) string { return fmt.Sprintf(` resource "aws_kms_key" "test" { - description = "Encrypts test bucket objects" + description = "Encrypts test objects" deletion_window_in_days = 7 } diff --git a/internal/service/s3/object_test.go b/internal/service/s3/object_test.go index b00ba882372..12e95f71c99 100644 --- a/internal/service/s3/object_test.go +++ b/internal/service/s3/object_test.go @@ -2001,7 +2001,7 @@ resource "aws_s3_object" "object" { func testAccObjectConfig_objectBucketKeyEnabled(rName string, content string) string { return fmt.Sprintf(` resource "aws_kms_key" "test" { - description = "Encrypts test bucket objects" + description = "Encrypts test objects" deletion_window_in_days = 7 } @@ -2022,7 +2022,7 @@ resource "aws_s3_object" "object" { func testAccObjectConfig_bucketBucketKeyEnabled(rName string, content string) string { return fmt.Sprintf(` resource "aws_kms_key" "test" { - description = "Encrypts test bucket objects" + description = "Encrypts test objects" deletion_window_in_days = 7 } @@ -2051,7 +2051,7 @@ resource "aws_s3_object" "object" { func testAccObjectConfig_defaultBucketSSE(rName string, content string) string { return fmt.Sprintf(` resource "aws_kms_key" "test" { - description = "Encrypts test bucket objects" + description = "Encrypts test objects" deletion_window_in_days = 7 } diff --git a/website/docs/r/s3_bucket.html.markdown b/website/docs/r/s3_bucket.html.markdown index 6e269c5c9b9..1aa05a81856 100644 --- a/website/docs/r/s3_bucket.html.markdown +++ b/website/docs/r/s3_bucket.html.markdown @@ -307,7 +307,7 @@ resource "aws_s3_bucket" "source" { ```terraform resource "aws_kms_key" "mykey" { - description = "This key is used to encrypt bucket objects" + description = "This key is used to encrypt objects" deletion_window_in_days = 10 } diff --git a/website/docs/r/signer_signing_job.html.markdown b/website/docs/r/signer_signing_job.html.markdown index 3022b433121..63eecd9afa4 100644 --- a/website/docs/r/signer_signing_job.html.markdown +++ b/website/docs/r/signer_signing_job.html.markdown @@ -57,7 +57,7 @@ The source configuration block supports the following arguments: The configuration block supports the following arguments: * `bucket` - (Required) Name of the S3 bucket. -* `key` - (Required) Key name of the bucket object that contains your unsigned code. +* `key` - (Required) Key name of the object that contains your unsigned code. * `version` - (Required) Version of your source image in your version enabled S3 bucket. ### Destination From 9b7c17a3c8e038d1044aea21d8af972a2d1c3b7e Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Mon, 31 Jan 2022 12:47:32 -0500 Subject: [PATCH 17/17] Misc updates --- website/docs/d/s3_objects.html.markdown | 2 +- website/docs/r/cloudtrail.html.markdown | 2 +- website/docs/r/s3_object.html.markdown | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/website/docs/d/s3_objects.html.markdown b/website/docs/d/s3_objects.html.markdown index 1b488786070..7ae4c32cbf8 100644 --- a/website/docs/d/s3_objects.html.markdown +++ b/website/docs/d/s3_objects.html.markdown @@ -10,7 +10,7 @@ description: |- ~> **NOTE on `max_keys`:** Retrieving very large numbers of keys can adversely affect Terraform's performance. -The bucket-objects data source returns keys (i.e., file names) and other metadata about objects in an S3 bucket. +The objects data source returns keys (i.e., file names) and other metadata about objects in an S3 bucket. ## Example Usage diff --git a/website/docs/r/cloudtrail.html.markdown b/website/docs/r/cloudtrail.html.markdown index 279b5155578..363aadab7d9 100644 --- a/website/docs/r/cloudtrail.html.markdown +++ b/website/docs/r/cloudtrail.html.markdown @@ -151,7 +151,7 @@ resource "aws_cloudtrail" "example" { # ... other configuration ... advanced_event_selector { - name = "Log all S3 buckets objects events except for two S3 buckets" + name = "Log all S3 objects events except for two S3 buckets" field_selector { field = "eventCategory" diff --git a/website/docs/r/s3_object.html.markdown b/website/docs/r/s3_object.html.markdown index d690538279d..fad048f3b29 100644 --- a/website/docs/r/s3_object.html.markdown +++ b/website/docs/r/s3_object.html.markdown @@ -40,7 +40,7 @@ resource "aws_s3_bucket" "examplebucket" { acl = "private" } -resource "aws_s3_object" "examplebucket_object" { +resource "aws_s3_object" "example" { key = "someobject" bucket = aws_s3_bucket.examplebucket.id source = "index.html" @@ -56,7 +56,7 @@ resource "aws_s3_bucket" "examplebucket" { acl = "private" } -resource "aws_s3_object" "examplebucket_object" { +resource "aws_s3_object" "example" { key = "someobject" bucket = aws_s3_bucket.examplebucket.id source = "index.html" @@ -72,7 +72,7 @@ resource "aws_s3_bucket" "examplebucket" { acl = "private" } -resource "aws_s3_object" "examplebucket_object" { +resource "aws_s3_object" "example" { key = "someobject" bucket = aws_s3_bucket.examplebucket.id source = "index.html" @@ -96,7 +96,7 @@ resource "aws_s3_bucket" "examplebucket" { } } -resource "aws_s3_object" "examplebucket_object" { +resource "aws_s3_object" "example" { key = "someobject" bucket = aws_s3_bucket.examplebucket.id source = "important.txt"