diff --git a/.changelog/33138.txt b/.changelog/33138.txt new file mode 100644 index 00000000000..61265f41170 --- /dev/null +++ b/.changelog/33138.txt @@ -0,0 +1,7 @@ +```release-note:bug +resource/aws_s3_object: Mark `acl` as Computed. This suppresses the diffs shown when migrating resources with no configured `acl` attribute value from v4.67.0 (or earlier) +``` + +```release-note:bug +resource/aws_s3_object_copy: Mark `acl` as Computed. This suppresses the diffs shown when migrating resources with no configured `acl` attribute value from v4.67.0 (or earlier) +``` \ No newline at end of file diff --git a/internal/service/s3/object.go b/internal/service/s3/object.go index e7bbdf0c4bf..f2ad0b06432 100644 --- a/internal/service/s3/object.go +++ b/internal/service/s3/object.go @@ -60,6 +60,7 @@ func ResourceObject() *schema.Resource { "acl": { Type: schema.TypeString, Optional: true, + Computed: true, ValidateFunc: validation.StringInSlice(s3.ObjectCannedACL_Values(), false), }, "bucket": { diff --git a/internal/service/s3/object_copy.go b/internal/service/s3/object_copy.go index 29548922f58..1c953747076 100644 --- a/internal/service/s3/object_copy.go +++ b/internal/service/s3/object_copy.go @@ -41,6 +41,7 @@ func ResourceObjectCopy() *schema.Resource { "acl": { Type: schema.TypeString, Optional: true, + Computed: true, ValidateFunc: validation.StringInSlice(s3.ObjectCannedACL_Values(), false), ConflictsWith: []string{"grant"}, }, diff --git a/internal/service/s3/object_test.go b/internal/service/s3/object_test.go index 275a5957fcd..6426f465c6d 100644 --- a/internal/service/s3/object_test.go +++ b/internal/service/s3/object_test.go @@ -85,6 +85,38 @@ func TestAccS3Object_empty(t *testing.T) { }) } +func TestAccS3Object_upgradeFromV4(t *testing.T) { + ctx := acctest.Context(t) + var obj s3.GetObjectOutput + resourceName := "aws_s3_object.object" + rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t) }, + ErrorCheck: acctest.ErrorCheck(t, s3.EndpointsID), + CheckDestroy: testAccCheckObjectDestroy(ctx), + Steps: []resource.TestStep{ + { + ExternalProviders: map[string]resource.ExternalProvider{ + "aws": { + Source: "hashicorp/aws", + VersionConstraint: "4.67.0", + }, + }, + Config: testAccObjectConfig_empty(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckObjectExists(ctx, resourceName, &obj), + ), + }, + { + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + Config: testAccObjectConfig_empty(rName), + PlanOnly: true, + }, + }, + }) +} + func TestAccS3Object_source(t *testing.T) { ctx := acctest.Context(t) var obj s3.GetObjectOutput