9
9
"github.com/aws/aws-sdk-go/service/s3"
10
10
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
11
11
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
12
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
12
13
)
13
14
14
15
func resourceScalewayObjectBucket () * schema.Resource {
@@ -30,6 +31,18 @@ func resourceScalewayObjectBucket() *schema.Resource {
30
31
ForceNew : true ,
31
32
Description : "The name of the bucket" ,
32
33
},
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
+ },
33
46
"tags" : {
34
47
Type : schema .TypeMap ,
35
48
Elem : & schema.Schema {
@@ -65,6 +78,7 @@ func resourceScalewayObjectBucket() *schema.Resource {
65
78
66
79
func resourceScalewayObjectBucketCreate (ctx context.Context , d * schema.ResourceData , meta interface {}) diag.Diagnostics {
67
80
bucketName := d .Get ("name" ).(string )
81
+ acl := d .Get ("acl" ).(string )
68
82
69
83
s3Client , region , err := s3ClientWithRegion (d , meta )
70
84
if err != nil {
@@ -73,6 +87,7 @@ func resourceScalewayObjectBucketCreate(ctx context.Context, d *schema.ResourceD
73
87
74
88
_ , err = s3Client .CreateBucketWithContext (ctx , & s3.CreateBucketInput {
75
89
Bucket : aws .String (bucketName ),
90
+ ACL : aws .String (acl ),
76
91
})
77
92
if err != nil {
78
93
return diag .FromErr (err )
0 commit comments