@@ -26,6 +26,7 @@ func (a *adapter) adaptBuckets() []s3.Bucket {
26
26
Versioning : getVersioning (block , a ),
27
27
Logging : getLogging (block , a ),
28
28
ACL : getBucketAcl (block , a ),
29
+ Grants : getGrants (block , a ),
29
30
AccelerateConfigurationStatus : getAccelerateStatus (block , a ),
30
31
BucketLocation : block .GetAttribute ("region" ).AsStringValueOrDefault ("" , block ),
31
32
LifecycleConfiguration : getLifecycle (block , a ),
@@ -193,6 +194,55 @@ func getBucketAcl(block *terraform.Block, a *adapter) iacTypes.StringValue {
193
194
return iacTypes .StringDefault ("private" , block .GetMetadata ())
194
195
}
195
196
197
+ func getGrants (block * terraform.Block , a * adapter ) []s3.Grant {
198
+ if val , ok := applyForBucketRelatedResource (a , block , "aws_s3_bucket_acl" , func (resource * terraform.Block ) []s3.Grant {
199
+ var grants []s3.Grant
200
+
201
+ if acessControlPolicy := resource .GetBlock ("access_control_policy" ); acessControlPolicy .IsNotNil () {
202
+ for _ , grantBlock := range acessControlPolicy .GetBlocks ("grant" ) {
203
+ grant := s3.Grant {
204
+ Metadata : grantBlock .GetMetadata (),
205
+ Permissions : iacTypes.StringValueList {
206
+ grantBlock .GetAttribute ("permission" ).AsStringValueOrDefault ("" , grantBlock ),
207
+ },
208
+ }
209
+
210
+ if granteeBlock := grantBlock .GetBlock ("grantee" ); granteeBlock .IsNotNil () {
211
+ grant .Grantee = s3.Grantee {
212
+ Metadata : granteeBlock .GetMetadata (),
213
+ Type : granteeBlock .GetAttribute ("type" ).AsStringValueOrDefault ("" , granteeBlock ),
214
+ URI : granteeBlock .GetAttribute ("uri" ).AsStringValueOrDefault ("" , granteeBlock ),
215
+ }
216
+ }
217
+
218
+ grants = append (grants , grant )
219
+ }
220
+ }
221
+
222
+ return grants
223
+
224
+ }); ok {
225
+ return val
226
+ }
227
+
228
+ var grants []s3.Grant
229
+ for _ , grantBlock := range block .GetBlocks ("grant" ) {
230
+ grant := s3.Grant {
231
+ Metadata : grantBlock .GetMetadata (),
232
+ Permissions : grantBlock .GetAttribute ("permissions" ).AsStringValueSliceOrEmpty (),
233
+ Grantee : s3.Grantee {
234
+ Metadata : grantBlock .GetMetadata (),
235
+ Type : grantBlock .GetAttribute ("type" ).AsStringValueOrDefault ("" , grantBlock ),
236
+ URI : grantBlock .GetAttribute ("uri" ).AsStringValueOrDefault ("" , grantBlock ),
237
+ },
238
+ }
239
+
240
+ grants = append (grants , grant )
241
+ }
242
+
243
+ return grants
244
+ }
245
+
196
246
func isEncrypted (sseConfgihuration * terraform.Block ) iacTypes.BoolValue {
197
247
return terraform .MapNestedAttribute (
198
248
sseConfgihuration ,
0 commit comments