@@ -56,15 +56,15 @@ locals {
56
56
for resource in try (definition. resources , []) : {
57
57
bucketId = resource . s3 . bucketId
58
58
actions = resource . s3 . actions
59
- iamActions = try (flatten ([resource . dynamodb . iamActions ]), [])
59
+ iam_actions = try (flatten ([resource . dynamodb . iamActions ]), [])
60
60
actions_string = join (" ," , sort (toset (flatten ([resource . s3 . actions , try (resource. s3 . iamActions , [])]))))
61
61
} if try (resource. s3 , null ) != null
62
62
]
63
63
dynamodb = [
64
64
for resource in try (definition. resources , []) : {
65
65
tableId = resource . dynamodb . tableId
66
66
actions = resource . dynamodb . actions
67
- iamActions = try (flatten ([resource . dynamodb . iamActions ]), [])
67
+ iam_actions = try (flatten ([resource . dynamodb . iamActions ]), [])
68
68
actions_string = join (" ," , sort (toset (flatten ([resource . dynamodb . actions , try (resource. dynamodb . iamActions , [])]))))
69
69
} if try (resource. dynamodb , null ) != null
70
70
]
@@ -153,27 +153,27 @@ data "aws_iam_policy_document" "s3_access" {
153
153
for_each = merge ([
154
154
for bucket in each . value : zipmap (
155
155
[bucket . actions_string ],
156
- [bucket . actions ]
156
+ [{ actions = table .actions, iam_actions = table.iam_actions } ]
157
157
)
158
158
]... )
159
159
160
160
content {
161
161
effect = " Allow"
162
162
163
163
actions = toset (concat (
164
- anytrue ([for action in [" read" , " get" ] : contains (statement. value , action)]) ? [
164
+ anytrue ([for action in [" read" , " get" ] : contains (statement. value . actions , action)]) ? [
165
165
" s3:GetObject" ,
166
166
] : [],
167
- anytrue ([for action in [" read" , " list" ] : contains (statement. value , action)]) ? [
167
+ anytrue ([for action in [" read" , " list" ] : contains (statement. value . actions , action)]) ? [
168
168
" s3:ListBucket" ,
169
169
] : [],
170
- contains (statement. value , " write" ) ? [
170
+ contains (statement. value . actions , " write" ) ? [
171
171
" s3:PutObject" ,
172
172
] : [],
173
- contains (statement. value , " delete" ) ? [
173
+ contains (statement. value . actions , " delete" ) ? [
174
174
" s3:DeleteObject" ,
175
175
] : [],
176
- statement. value . iamActions ,
176
+ statement. value . iam_actions ,
177
177
))
178
178
179
179
resources = flatten ([
@@ -193,7 +193,7 @@ data "aws_iam_policy_document" "dynamodb_access" {
193
193
for_each = merge ([
194
194
for table in each . value : zipmap (
195
195
[table . actions_string ],
196
- [{ actions = table.actions, iamActions = table.iamActions }]
196
+ [{ actions = table.actions, iam_actions = table.iam_actions }]
197
197
)
198
198
]... )
199
199
@@ -219,7 +219,7 @@ data "aws_iam_policy_document" "dynamodb_access" {
219
219
contains (statement. value . actions , " scan" ) ? [
220
220
" dynamodb:Scan" ,
221
221
] : [],
222
- statement. value . iamActions ,
222
+ statement. value . iam_actions ,
223
223
))
224
224
225
225
resources = flatten ([
0 commit comments