@@ -148,7 +148,8 @@ locals {
148
148
# `yaml` is intentionally used here as we require Stack and `tfvars` config files to be named equally
149
149
" tfvars_file_name" = trimsuffix (file, " .yaml" ),
150
150
},
151
- content
151
+ content,
152
+ try (var. runtime_overrides [module ], {}),
152
153
) if file != var . common_config_file
153
154
}
154
155
]... )
@@ -266,6 +267,16 @@ locals {
266
267
try (local. stack_configs [stack ]. before_init , []),
267
268
))
268
269
}
270
+
271
+ aws_integration_stacks = {
272
+ for stack , config in local . stack_configs :
273
+ stack = > config if try (config. aws_integration_enabled , var. aws_integration_enabled )
274
+ }
275
+
276
+ drift_detection_stacks = {
277
+ for stack , config in local . stack_configs :
278
+ stack = > config if try (config. drift_detection_enabled , var. drift_detection_enabled )
279
+ }
269
280
}
270
281
271
282
# Perform deep merge for common configurations and stack configurations
@@ -346,21 +357,16 @@ resource "spacelift_stack_destructor" "default" {
346
357
}
347
358
348
359
resource "spacelift_aws_integration_attachment" "default" {
349
- for_each = {
350
- for stack , configs in local . stack_configs : stack => configs
351
- if try (configs. aws_integration_enabled , var. aws_integration_enabled )
352
- }
360
+ for_each = local. aws_integration_stacks
361
+
353
362
integration_id = try (local. stack_configs [each . key ]. aws_integration_id , var. aws_integration_id )
354
363
stack_id = spacelift_stack. default [each . key ]. id
355
364
read = var. aws_integration_attachment_read
356
365
write = var. aws_integration_attachment_write
357
366
}
358
367
359
368
resource "spacelift_drift_detection" "default" {
360
- for_each = {
361
- for stack , configs in local . stack_configs : stack => configs
362
- if try (configs. drift_detection_enabled , var. drift_detection_enabled )
363
- }
369
+ for_each = local. drift_detection_stacks
364
370
365
371
stack_id = spacelift_stack. default [each . key ]. id
366
372
ignore_state = try (local. stack_configs [each . key ]. drift_detection_ignore_state , var. drift_detection_ignore_state )
0 commit comments