Skip to content

Commit

Permalink
Merge pull request #954 from NOAA-OWP/apocalyptic-testing-framework
Browse files Browse the repository at this point in the history
Fixes terraform apply error
  • Loading branch information
DrixTabligan-NOAA authored Nov 13, 2024
2 parents 9ece09b + f1bdf23 commit fce6454
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
12 changes: 6 additions & 6 deletions Core/Testing/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ variable "viz_initialize_pipeline_arn" {
type = string
}

variable "step_function_arn" {
variable "lambda_role" {
type = string
}

Expand Down Expand Up @@ -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",
Expand All @@ -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()))
}
7 changes: 6 additions & 1 deletion Core/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit fce6454

Please sign in to comment.