Skip to content

Commit 34b055d

Browse files
committed
fix(object): support all grantee type enum value of "Type"
1 parent 3a38fcc commit 34b055d

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

internal/services/object/bucket_acl.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func ResourceBucketACL() *schema.Resource {
7070
Type: schema.TypeString,
7171
Required: true,
7272
Description: "Type of grantee. Valid values: `CanonicalUser`",
73-
ValidateFunc: validation.StringInSlice([]string{string(s3Types.TypeCanonicalUser)}, false),
73+
ValidateFunc: validation.StringInSlice((s3GranteeTypeValueToStrings()), false),
7474
},
7575
},
7676
},

internal/services/object/helpers_object.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,3 +729,16 @@ func addReadBucketErrorDiagnostic(diags *diag.Diagnostics, err error, resource s
729729
return true, true
730730
}
731731
}
732+
733+
func s3GranteeTypeValueToStrings() []string {
734+
var t s3Types.Type
735+
values := t.Values()
736+
737+
strings := make([]string, len(values))
738+
739+
for i, value := range values {
740+
strings[i] = string(value)
741+
}
742+
743+
return strings
744+
}

0 commit comments

Comments
 (0)