Skip to content

Commit 8f6b453

Browse files
committed
Add new script and job for creating a Data Quality test metatdata table to add additional information to accompany Housing GX data quality test results.
1 parent 539f8cd commit 8f6b453

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

terraform/etl/54-aws-glue-housing-apply-gx-dq-tests.tf

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,52 @@ module "housing_apply_gx_dq_tests" {
3333

3434
script_name = "housing_apply_gx_dq_tests"
3535
}
36+
37+
module "housing_gx_dq_metadata" {
38+
source = "../modules/aws-glue-job"
39+
is_production_environment = local.is_production_environment
40+
is_live_environment = local.is_live_environment
41+
42+
count = local.is_live_environment ? 1 : 0
43+
44+
department = module.department_housing_data_source
45+
job_name = "${local.short_identifier_prefix}Housing GX Data Quality Metadata"
46+
glue_scripts_bucket_id = module.glue_scripts_data_source.bucket_id
47+
glue_temp_bucket_id = module.glue_temp_storage_data_source.bucket_id
48+
glue_job_timeout = 360
49+
helper_module_key = data.aws_s3_object.helpers.key
50+
pydeequ_zip_key = data.aws_s3_object.pydeequ.key
51+
spark_ui_output_storage_id = module.spark_ui_output_storage_data_source.bucket_id
52+
trigger_enabled = local.is_production_environment
53+
number_of_workers_for_glue_job = 2
54+
job_parameters = {
55+
"--job-bookmark-option" = "job-bookmark-enable"
56+
"--enable-glue-datacatalog" = "true"
57+
"--enable-continuous-cloudwatch-log" = "true"
58+
"--additional-python-modules" = "great_expectations==1.2.1,numpy==1.26.1,awswrangler==3.10.0"
59+
"--region_name" = data.aws_region.current.name
60+
"--s3_endpoint" = "https://s3.${data.aws_region.current.name}.amazonaws.com"
61+
"--s3_target_location" = "s3://${module.raw_zone_data_source.bucket_id}/housing/data-quality-test-metadata/"
62+
"--s3_staging_location" = "s3://${module.athena_storage_data_source.bucket_id}/housing/data-quality-test-metadata/"
63+
"--target_database" = "housing-raw-zone"
64+
"--target_table" = "housing_gx_data_quality_test_metadata"
65+
}
66+
67+
script_name = "housing_gx_dq_metadata"
68+
}
69+
70+
resource "aws_glue_trigger" "housing_gx_dq_metadata" {
71+
name = "${local.short_identifier_prefix}Housing GX Data Quality Metadata Trigger"
72+
type = "CONDITIONAL"
73+
74+
actions {
75+
job_name = "${local.short_identifier_prefix}Housing GX Data Quality Metadata"
76+
}
77+
78+
predicate {
79+
conditions {
80+
job_name = "${local.short_identifier_prefix}Housing GX Data Quality Testing"
81+
state = "SUCCEEDED"
82+
}
83+
}
84+
}

0 commit comments

Comments
 (0)