1
1
data "aws_iam_policy_document" "truefoundry_platform_feature_s3_policy_document" {
2
- count = var. platform_feature_enabled ? var . feature_blob_storage_enabled ? 1 : 0 : 0
2
+ count = var. feature_blob_storage_enabled ? 1 : 0
3
3
statement {
4
4
effect = " Allow"
5
5
actions = [
@@ -14,7 +14,7 @@ data "aws_iam_policy_document" "truefoundry_platform_feature_s3_policy_document"
14
14
}
15
15
16
16
data "aws_iam_policy_document" "truefoundry_platform_feature_parameter_store_policy_document" {
17
- count = var. platform_feature_enabled ? var . feature_parameter_store_enabled ? 1 : 0 : 0
17
+ count = var. feature_parameter_store_enabled ? 1 : 0
18
18
statement {
19
19
effect = " Allow"
20
20
actions = [
@@ -32,7 +32,7 @@ data "aws_iam_policy_document" "truefoundry_platform_feature_parameter_store_pol
32
32
}
33
33
34
34
data "aws_iam_policy_document" "truefoundry_platform_feature_secrets_manager_policy_document" {
35
- count = var. platform_feature_enabled ? var . feature_secrets_manager_enabled ? 1 : 0 : 0
35
+ count = var. feature_secrets_manager_enabled ? 1 : 0
36
36
statement {
37
37
effect = " Allow"
38
38
actions = [
@@ -51,7 +51,7 @@ data "aws_iam_policy_document" "truefoundry_platform_feature_secrets_manager_pol
51
51
}
52
52
53
53
data "aws_iam_policy_document" "truefoundry_platform_feature_ecr_policy_document" {
54
- count = var. platform_feature_enabled ? var . feature_docker_registry_enabled ? 1 : 0 : 0
54
+ count = var. feature_docker_registry_enabled ? 1 : 0
55
55
statement {
56
56
effect = " Allow"
57
57
actions = [
@@ -94,7 +94,7 @@ data "aws_iam_policy_document" "truefoundry_platform_feature_ecr_policy_document
94
94
}
95
95
96
96
data "aws_iam_policy_document" "truefoundry_platform_feature_cluster_integration_policy_document" {
97
- count = var. platform_feature_enabled ? var . feature_cluster_integration_enabled ? 1 : 0 : 0
97
+ count = var. feature_cluster_integration_enabled ? 1 : 0
98
98
statement {
99
99
effect = " Allow"
100
100
actions = [
@@ -141,31 +141,31 @@ data "aws_iam_policy_document" "truefoundry_platform_feature_cluster_integration
141
141
142
142
143
143
resource "aws_iam_policy" "truefoundry_platform_feature_s3_policy" {
144
- count = var. platform_feature_enabled ? var . feature_blob_storage_enabled ? 1 : 0 : 0
144
+ count = var. feature_blob_storage_enabled ? 1 : 0
145
145
name_prefix = " ${ local . truefoundry_unique_name } -s3-access"
146
146
description = " IAM policy for TrueFoundry user for platform features blob storage"
147
147
policy = data. aws_iam_policy_document . truefoundry_platform_feature_s3_policy_document [0 ]. json
148
148
tags = local. tags
149
149
}
150
150
151
151
resource "aws_iam_policy" "truefoundry_platform_feature_parameter_store_policy" {
152
- count = var. platform_feature_enabled ? var . feature_parameter_store_enabled ? 1 : 0 : 0
152
+ count = var. feature_parameter_store_enabled ? 1 : 0
153
153
name_prefix = " ${ local . truefoundry_unique_name } -parameter-store-access"
154
154
description = " IAM policy for TrueFoundry user for platform features Secrets manager"
155
155
policy = data. aws_iam_policy_document . truefoundry_platform_feature_parameter_store_policy_document [0 ]. json
156
156
tags = local. tags
157
157
}
158
158
159
159
resource "aws_iam_policy" "truefoundry_platform_feature_secrets_manager_policy" {
160
- count = var. platform_feature_enabled ? var . feature_secrets_manager_enabled ? 1 : 0 : 0
160
+ count = var. feature_secrets_manager_enabled ? 1 : 0
161
161
name_prefix = " ${ local . truefoundry_unique_name } -secrets-manager-access"
162
162
description = " IAM policy for TrueFoundry user for platform features Secrets manager"
163
163
policy = data. aws_iam_policy_document . truefoundry_platform_feature_secrets_manager_policy_document [0 ]. json
164
164
tags = local. tags
165
165
}
166
166
167
167
resource "aws_iam_policy" "truefoundry_platform_feature_ecr_policy" {
168
- count = var. platform_feature_enabled ? var . feature_docker_registry_enabled ? 1 : 0 : 0
168
+ count = var. feature_docker_registry_enabled ? 1 : 0
169
169
name_prefix = " ${ local . truefoundry_unique_name } -ecr-access"
170
170
description = " IAM policy for TrueFoundry user for platform features docker registry"
171
171
policy = data. aws_iam_policy_document . truefoundry_platform_feature_ecr_policy_document [0 ]. json
@@ -174,7 +174,7 @@ resource "aws_iam_policy" "truefoundry_platform_feature_ecr_policy" {
174
174
175
175
176
176
resource "aws_iam_policy" "truefoundry_platform_feature_cluster_integration_policy" {
177
- count = var. platform_feature_enabled ? var . feature_cluster_integration_enabled ? 1 : 0 : 0
177
+ count = var. feature_cluster_integration_enabled ? 1 : 0
178
178
name_prefix = " ${ local . truefoundry_unique_name } -cluster-integration-access"
179
179
description = " IAM policy for TrueFoundry user for platform features cluster integration"
180
180
policy = data. aws_iam_policy_document . truefoundry_platform_feature_cluster_integration_policy_document [0 ]. json
@@ -186,7 +186,7 @@ resource "aws_iam_policy" "truefoundry_platform_feature_cluster_integration_poli
186
186
# ###############################################################################
187
187
188
188
resource "aws_iam_role" "truefoundry_platform_feature_iam_role" {
189
- count = var. platform_feature_enabled ? 1 : 0
189
+ count = var. platform_role_enable_override ? 1 : 0
190
190
name = var. platform_role_enable_override ? var. platform_role_override_name : null
191
191
description = " IAM role for TrueFoundry platform to access S3 bucket, SSM, ECR and EKS"
192
192
name_prefix = var. platform_role_enable_override ? null : " ${ local . truefoundry_unique_name } -iam-role-"
@@ -208,31 +208,31 @@ resource "aws_iam_role" "truefoundry_platform_feature_iam_role" {
208
208
}
209
209
210
210
resource "aws_iam_role_policy_attachment" "truefoundry_platform_s3_policy_attachment" {
211
- count = var. platform_feature_enabled ? var . feature_blob_storage_enabled ? 1 : 0 : 0
211
+ count = var. feature_blob_storage_enabled ? 1 : 0
212
212
role = aws_iam_role. truefoundry_platform_feature_iam_role [0 ]. name
213
213
policy_arn = aws_iam_policy. truefoundry_platform_feature_s3_policy [0 ]. arn
214
214
}
215
215
216
216
resource "aws_iam_role_policy_attachment" "truefoundry_platform_parameter_store_policy_attachment" {
217
- count = var. platform_feature_enabled ? var . feature_parameter_store_enabled ? 1 : 0 : 0
217
+ count = var. feature_parameter_store_enabled ? 1 : 0
218
218
role = aws_iam_role. truefoundry_platform_feature_iam_role [0 ]. name
219
219
policy_arn = aws_iam_policy. truefoundry_platform_feature_parameter_store_policy [0 ]. arn
220
220
}
221
221
222
222
resource "aws_iam_role_policy_attachment" "truefoundry_platform_secrets_manager_policy_attachment" {
223
- count = var. platform_feature_enabled ? var . feature_secrets_manager_enabled ? 1 : 0 : 0
223
+ count = var. feature_secrets_manager_enabled ? 1 : 0
224
224
role = aws_iam_role. truefoundry_platform_feature_iam_role [0 ]. name
225
225
policy_arn = aws_iam_policy. truefoundry_platform_feature_secrets_manager_policy [0 ]. arn
226
226
}
227
227
228
228
resource "aws_iam_role_policy_attachment" "truefoundry_platform_ecr_policy_attachment" {
229
- count = var. platform_feature_enabled ? var . feature_docker_registry_enabled ? 1 : 0 : 0
229
+ count = var. feature_docker_registry_enabled ? 1 : 0
230
230
role = aws_iam_role. truefoundry_platform_feature_iam_role [0 ]. name
231
231
policy_arn = aws_iam_policy. truefoundry_platform_feature_ecr_policy [0 ]. arn
232
232
}
233
233
234
234
resource "aws_iam_role_policy_attachment" "truefoundry_platform_cluster_integration_policy_attachment" {
235
- count = var. platform_feature_enabled ? var . feature_cluster_integration_enabled ? 1 : 0 : 0
235
+ count = var. feature_cluster_integration_enabled ? 1 : 0
236
236
role = aws_iam_role. truefoundry_platform_feature_iam_role [0 ]. name
237
237
policy_arn = aws_iam_policy. truefoundry_platform_feature_cluster_integration_policy [0 ]. arn
238
238
}
@@ -242,7 +242,7 @@ resource "aws_iam_role_policy_attachment" "truefoundry_platform_cluster_integrat
242
242
# IAM user
243
243
# ###############################################################################
244
244
resource "aws_iam_user" "truefoundry_platform_user" {
245
- count = var. platform_feature_enabled && var . platform_user_enabled ? 1 : 0
245
+ count = var. platform_user_enabled ? 1 : 0
246
246
247
247
name = var. platform_user_name_override_enabled ? var. platform_user_override_name : " ${ local . truefoundry_unique_name } -user"
248
248
path = " /truefoundry/"
@@ -251,37 +251,37 @@ resource "aws_iam_user" "truefoundry_platform_user" {
251
251
}
252
252
253
253
resource "aws_iam_access_key" "truefoundry_platform_user_keys" {
254
- count = var. platform_feature_enabled && var . platform_user_enabled ? 1 : 0
254
+ count = var. platform_user_enabled ? 1 : 0
255
255
256
256
user = aws_iam_user. truefoundry_platform_user [0 ]. name
257
257
}
258
258
259
259
resource "aws_iam_user_policy_attachment" "truefoundry_platform_user_s3_policy_attachment" {
260
- count = var . platform_feature_enabled ? (var. feature_blob_storage_enabled && var. platform_user_enabled ) ? 1 : 0 : 0
260
+ count = (var. feature_blob_storage_enabled && var. platform_user_enabled ) ? 1 : 0
261
261
user = aws_iam_user. truefoundry_platform_user [0 ]. name
262
262
policy_arn = aws_iam_policy. truefoundry_platform_feature_s3_policy [0 ]. arn
263
263
}
264
264
265
265
resource "aws_iam_user_policy_attachment" "truefoundry_platform_user_parameter_store_policy_attachment" {
266
- count = var . platform_feature_enabled ? (var. feature_parameter_store_enabled && var. platform_user_enabled ) ? 1 : 0 : 0
266
+ count = (var. feature_parameter_store_enabled && var. platform_user_enabled ) ? 1 : 0
267
267
user = aws_iam_user. truefoundry_platform_user [0 ]. name
268
268
policy_arn = aws_iam_policy. truefoundry_platform_feature_parameter_store_policy [0 ]. arn
269
269
}
270
270
271
271
resource "aws_iam_user_policy_attachment" "truefoundry_platform_user_secrets_manager_policy_attachment" {
272
- count = var . platform_feature_enabled ? (var. feature_secrets_manager_enabled && var. platform_user_enabled ) ? 1 : 0 : 0
272
+ count = (var. feature_secrets_manager_enabled && var. platform_user_enabled ) ? 1 : 0
273
273
user = aws_iam_user. truefoundry_platform_user [0 ]. name
274
274
policy_arn = aws_iam_policy. truefoundry_platform_feature_secrets_manager_policy [0 ]. arn
275
275
}
276
276
277
277
resource "aws_iam_user_policy_attachment" "truefoundry_platform_user_ecr_policy_attachment" {
278
- count = var . platform_feature_enabled ? (var. feature_docker_registry_enabled && var. platform_user_enabled ) ? 1 : 0 : 0
278
+ count = (var. feature_docker_registry_enabled && var. platform_user_enabled ) ? 1 : 0
279
279
user = aws_iam_user. truefoundry_platform_user [0 ]. name
280
280
policy_arn = aws_iam_policy. truefoundry_platform_feature_ecr_policy [0 ]. arn
281
281
}
282
282
283
283
resource "aws_iam_user_policy_attachment" "truefoundry_platform_user_cluster_integration_policy_attachment" {
284
- count = var . platform_feature_enabled ? (var. feature_cluster_integration_enabled && var. platform_user_enabled ) ? 1 : 0 : 0
284
+ count = (var. feature_cluster_integration_enabled && var. platform_user_enabled ) ? 1 : 0
285
285
user = aws_iam_user. truefoundry_platform_user [0 ]. name
286
286
policy_arn = aws_iam_policy. truefoundry_platform_feature_cluster_integration_policy [0 ]. arn
287
287
}
0 commit comments