Skip to content

Commit eec8baf

Browse files
committed
Fix
1 parent cb18537 commit eec8baf

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

scaleway/resource_object_bucket.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"github.com/aws/aws-sdk-go/service/s3"
1010
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
1111
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
12+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
1213
)
1314

1415
func resourceScalewayObjectBucket() *schema.Resource {
@@ -30,6 +31,18 @@ func resourceScalewayObjectBucket() *schema.Resource {
3031
ForceNew: true,
3132
Description: "The name of the bucket",
3233
},
34+
"acl": {
35+
Type: schema.TypeString,
36+
Optional: true,
37+
Default: "private",
38+
Description: "ACL of the bucket: either 'public-read' or 'private'.",
39+
ValidateFunc: validation.StringInSlice([]string{
40+
s3.ObjectCannedACLPrivate,
41+
s3.ObjectCannedACLPublicRead,
42+
s3.ObjectCannedACLPublicReadWrite,
43+
s3.ObjectCannedACLAuthenticatedRead,
44+
}, false),
45+
},
3346
"tags": {
3447
Type: schema.TypeMap,
3548
Elem: &schema.Schema{
@@ -65,6 +78,7 @@ func resourceScalewayObjectBucket() *schema.Resource {
6578

6679
func resourceScalewayObjectBucketCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
6780
bucketName := d.Get("name").(string)
81+
acl := d.Get("acl").(string)
6882

6983
s3Client, region, err := s3ClientWithRegion(d, meta)
7084
if err != nil {
@@ -73,6 +87,7 @@ func resourceScalewayObjectBucketCreate(ctx context.Context, d *schema.ResourceD
7387

7488
_, err = s3Client.CreateBucketWithContext(ctx, &s3.CreateBucketInput{
7589
Bucket: aws.String(bucketName),
90+
ACL: aws.String(acl),
7691
})
7792
if err != nil {
7893
return diag.FromErr(err)

0 commit comments

Comments
 (0)