Skip to content

Commit af073d2

Browse files
authored
combine tables into one job (#806)
1 parent 239e695 commit af073d2

File tree

1 file changed

+9
-17
lines changed

1 file changed

+9
-17
lines changed

terraform/core/39-housing-interim-finance-db-ingestion.tf

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,18 @@ module "housing_interim_finance_database_ingestion" {
1414
}
1515

1616
locals {
17-
table_filter_expressions_housing_interim_finance = local.is_live_environment ? {
18-
ma-tenancy-agreement = "^sow2b_dbo_matenancyagreement$",
19-
uh-account-recovery-action = "^sow2b_dbo_uharaction$",
20-
ma-property = "^sow2b_dbo_maproperty$",
21-
uh-mini-transaction = "^sow2b_dbo_uhminitransaction$",
22-
ss-mini-transaction = "^sow2b_dbo_ssminitransaction$"
23-
} : {}
17+
table_filter_expressions_housing_interim_finance = local.is_live_environment ? "(^sow2b_dbo_matenancyagreement$|^sow2b_dbo_uharaction$|^sow2b_dbo_maproperty$|^sow2b_dbo_uhminitransaction$|^sow2b_dbo_ssminitransaction$)" : ""
2418
}
2519

2620
resource "aws_glue_trigger" "housing_interim_finance_filter_ingestion_tables" {
27-
tags = module.tags.values
28-
for_each = local.table_filter_expressions_housing_interim_finance
29-
name = "${local.short_identifier_prefix}housing-interim-finance-table-${each.key}"
30-
type = "CONDITIONAL"
21+
tags = module.tags.values
22+
name = "${local.short_identifier_prefix}housing-interim-finance-tables"
23+
type = "CONDITIONAL"
3124

3225
actions {
33-
job_name = module.ingest_housing_interim_finance_database_to_housing_raw_zone[each.key].job_name
26+
job_name = module.ingest_housing_interim_finance_database_to_housing_raw_zone.job_name
3427
arguments = {
35-
"--table_filter_expression" = each.value
28+
"--table_filter_expression" = local.table_filter_expressions_housing_interim_finance
3629
}
3730
}
3831

@@ -45,14 +38,13 @@ resource "aws_glue_trigger" "housing_interim_finance_filter_ingestion_tables" {
4538
}
4639

4740
module "ingest_housing_interim_finance_database_to_housing_raw_zone" {
48-
for_each = local.table_filter_expressions_housing_interim_finance
49-
tags = module.tags.values
41+
tags = module.tags.values
5042

5143
source = "../modules/aws-glue-job"
5244

5345
department = module.department_housing
5446

55-
job_name = "${local.short_identifier_prefix}Housing Interim Finance Database Ingestion-${each.key}"
47+
job_name = "${local.short_identifier_prefix}Housing Interim Finance Database Ingestion"
5648
script_s3_object_key = aws_s3_bucket_object.ingest_database_tables_via_jdbc_connection.key
5749
environment = var.environment
5850
pydeequ_zip_key = aws_s3_bucket_object.pydeequ.key
@@ -65,7 +57,7 @@ module "ingest_housing_interim_finance_database_to_housing_raw_zone" {
6557
"--source_data_database" = module.housing_interim_finance_database_ingestion[0].ingestion_database_name
6658
"--s3_ingestion_bucket_target" = "s3://${module.raw_zone.bucket_id}/housing/"
6759
"--s3_ingestion_details_target" = "s3://${module.raw_zone.bucket_id}/housing/ingestion-details/"
68-
"--table_filter_expression" = each.value
60+
"--table_filter_expression" = local.table_filter_expressions_housing_interim_finance
6961
}
7062
crawler_details = {
7163
database_name = module.department_housing.raw_zone_catalog_database_name

0 commit comments

Comments
 (0)