From d47971641d76bb6c8a1ef7149255d92e463a6a6c Mon Sep 17 00:00:00 2001 From: timburke-hackit Date: Mon, 6 Nov 2023 12:28:13 +0000 Subject: [PATCH] add academy state machine in stg --- terraform/core/13-mssql-ingestion.tf | 131 +++++++++++++++++++++++++++ 1 file changed, 131 insertions(+) diff --git a/terraform/core/13-mssql-ingestion.tf b/terraform/core/13-mssql-ingestion.tf index 218178c7e..f8d995c69 100644 --- a/terraform/core/13-mssql-ingestion.tf +++ b/terraform/core/13-mssql-ingestion.tf @@ -195,3 +195,134 @@ module "copy_academy_revenues_to_raw_zone" { "--conf" = "spark.sql.legacy.timeParserPolicy=LEGACY --conf spark.sql.legacy.parquet.int96RebaseModeInRead=LEGACY --conf spark.sql.legacy.parquet.int96RebaseModeInWrite=LEGACY --conf spark.sql.legacy.parquet.datetimeRebaseModeInRead=LEGACY --conf spark.sql.legacy.parquet.datetimeRebaseModeInWrite=LEGACY" } } + +## Academy State Machine + +locals { + academy_state_machine_count = local.is_live_environment && !local.is_production_environment ? 1 : 0 +} + +module "academy_glue_job" { + count = local.academy_state_machine_count + source = "../modules/aws-glue-job" + tags = module.tags.values + is_live_environment = local.is_live_environment + is_production_environment = local.is_production_environment + + job_name = "${local.short_identifier_prefix}Academy Revs & Bens Housing Needs Database Ingestion" + script_s3_object_key = aws_s3_object.ingest_database_tables_via_jdbc_connection.key + environment = var.environment + pydeequ_zip_key = aws_s3_object.pydeequ.key + helper_module_key = aws_s3_object.helpers.key + jdbc_connections = [module.academy_mssql_database_ingestion[0].jdbc_connection_name] + glue_role_arn = aws_iam_role.glue_role.arn + glue_temp_bucket_id = module.glue_temp_storage.bucket_id + glue_scripts_bucket_id = module.glue_scripts.bucket_id + spark_ui_output_storage_id = module.spark_ui_output_storage.bucket_id + glue_job_timeout = 420 + glue_version = "4.0" + glue_job_worker_type = "G.1X" + number_of_workers_for_glue_job = 2 + job_parameters = { + "--source_data_database" = module.academy_mssql_database_ingestion[0].ingestion_database_name + "--s3_ingestion_bucket_target" = "s3://${module.landing_zone.bucket_id}/academy/" + "--s3_ingestion_details_target" = "s3://${module.landing_zone.bucket_id}/academy/ingestion-details/" + "--table_filter_expression" = "" + "--conf" = "spark.sql.legacy.timeParserPolicy=LEGACY --conf spark.sql.legacy.parquet.int96RebaseModeInRead=LEGACY --conf spark.sql.legacy.parquet.int96RebaseModeInWrite=LEGACY --conf spark.sql.legacy.parquet.datetimeRebaseModeInRead=LEGACY --conf spark.sql.legacy.parquet.datetimeRebaseModeInWrite=LEGACY" + } +} + + +module "academy_state_machine" { + count = local.academy_state_machine_count + tags = module.tags.values + source = "../modules/aws-step-functions" + name = "academy-revs-and-bens-housing-needs-database-ingestion" + identifier_prefix = local.short_identifier_prefix + role_arn = aws_iam_role.academy_step_functions_role[0].arn + definition = <