From 34b055de84dd9e9c56fb42f04dad6ce28d826ca2 Mon Sep 17 00:00:00 2001 From: Guillaume Noale Date: Wed, 18 Jun 2025 17:12:45 +0200 Subject: [PATCH] fix(object): support all grantee type enum value of "Type" --- internal/services/object/bucket_acl.go | 2 +- internal/services/object/helpers_object.go | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/internal/services/object/bucket_acl.go b/internal/services/object/bucket_acl.go index f854221357..80ea2fe1a9 100644 --- a/internal/services/object/bucket_acl.go +++ b/internal/services/object/bucket_acl.go @@ -70,7 +70,7 @@ func ResourceBucketACL() *schema.Resource { Type: schema.TypeString, Required: true, Description: "Type of grantee. Valid values: `CanonicalUser`", - ValidateFunc: validation.StringInSlice([]string{string(s3Types.TypeCanonicalUser)}, false), + ValidateFunc: validation.StringInSlice((s3GranteeTypeValueToStrings()), false), }, }, }, diff --git a/internal/services/object/helpers_object.go b/internal/services/object/helpers_object.go index aacc3dcee2..1f6b8a2faa 100644 --- a/internal/services/object/helpers_object.go +++ b/internal/services/object/helpers_object.go @@ -729,3 +729,16 @@ func addReadBucketErrorDiagnostic(diags *diag.Diagnostics, err error, resource s return true, true } } + +func s3GranteeTypeValueToStrings() []string { + var t s3Types.Type + values := t.Values() + + strings := make([]string, len(values)) + + for i, value := range values { + strings[i] = string(value) + } + + return strings +}