diff --git a/Core/Testing/main.tf b/Core/Testing/main.tf index c667b389..af8cddd7 100644 --- a/Core/Testing/main.tf +++ b/Core/Testing/main.tf @@ -10,7 +10,7 @@ variable "viz_initialize_pipeline_arn" { type = string } -variable "step_function_arn" { +variable "lambda_role" { type = string } @@ -39,6 +39,7 @@ resource "aws_cloudwatch_event_target" "trigger_pipeline_test_run" { rule = aws_cloudwatch_event_rule.detect_test_files.name target_id = "initialize_pipeline" arn = var.viz_initialize_pipeline_arn + role_arn = var.lambda_role input_transformer { input_paths = { "s3_bucket": "$.detail.bucket.name", @@ -63,12 +64,11 @@ data "aws_s3_objects" "test_nwm_outputs" { bucket = var.test_data_bucket prefix = "test_nwm_outputs/" max_keys = 2000 - depends_on = [var.step_function_arn] } resource "aws_s3_object_copy" "test" { - count = length(data.aws_s3_objects.test_nwm_outputs.keys) - bucket = var.test_data_bucket - source = join("/", [var.test_data_bucket, element(data.aws_s3_objects.test_nwm_outputs.keys, count.index)]) - key = replace(element(data.aws_s3_objects.test_nwm_outputs.keys, count.index), "test_nwm_outputs", formatdate("'common/data/model/com/nwm/prod/nwm.'YYYYDDMM", timestamp())) + count = length(data.aws_s3_objects.test_nwm_outputs.keys) + bucket = var.test_data_bucket + source = join("/", [var.test_data_bucket, element(data.aws_s3_objects.test_nwm_outputs.keys, count.index)]) + key = replace(element(data.aws_s3_objects.test_nwm_outputs.keys, count.index), "test_nwm_outputs", formatdate("'common/data/model/com/nwm/prod/nwm.'YYYYMMDD", timestamp())) } diff --git a/Core/main.tf b/Core/main.tf index 4812a42c..64737e88 100644 --- a/Core/main.tf +++ b/Core/main.tf @@ -710,9 +710,14 @@ module "sync-wrds-location-db" { module "testing" { count = local.env.environment == "ti" ? 1 : 0 source = "./Testing" + depends_on = [ + module.s3.buckets, + module.step-functions.viz_pipeline_step_function, + module.viz-lambda-functions + ] environment = local.env.environment test_data_bucket = module.s3.buckets["deployment"].bucket viz_initialize_pipeline_arn = module.viz-lambda-functions.initialize_pipeline.arn - step_function_arn = module.step-functions.viz_pipeline_step_function.arn + lambda_role = module.iam-roles.role_viz_pipeline.arn }