-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: configure the Glue jobs with a map (#45)
- Loading branch information
1 parent
d9f6fa9
commit 45bdd02
Showing
3 changed files
with
36 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,16 @@ | ||
resource "aws_glue_job" "bronze_us_legislators" { | ||
name = "glue-ci-cd-bronze-us-legislators-${var.environment}" | ||
description = "Sample Bronze-layer job for the AWS Glue CI/CD Blueprint." | ||
role_arn = aws_iam_role.glue_service.arn | ||
glue_version = "4.0" | ||
worker_type = "G.1X" | ||
number_of_workers = 2 | ||
execution_class = "FLEX" | ||
default_arguments = { | ||
"--source-bucket-name" = "awsglue-datasets", | ||
"--source-file-path" = "examples/us-legislators/all/persons.json", | ||
"--target-bucket-name" = var.data_bucket_id, | ||
"--target-file-path" = "bronze/awsglue-datasets/us-legislators/all-persons.json", | ||
} | ||
tags = local.default_tags | ||
command { | ||
script_location = "s3://${aws_s3_bucket.glue["scripts"].id}/s3_to_s3_job.py" | ||
} | ||
} | ||
resource "aws_glue_job" "us_legislators" { | ||
for_each = local.us_legislators_jobs_map | ||
|
||
resource "aws_glue_job" "silver_us_legislators" { | ||
name = "glue-ci-cd-silver-us-legislators-${var.environment}" | ||
description = "Sample Silver-layer job for the AWS Glue CI/CD Blueprint." | ||
name = each.value.name | ||
description = each.value.description | ||
role_arn = aws_iam_role.glue_service.arn | ||
glue_version = "4.0" | ||
worker_type = "G.1X" | ||
number_of_workers = 2 | ||
execution_class = "FLEX" | ||
default_arguments = { | ||
"--source-bucket-name" = var.data_bucket_id, | ||
"--source-file-path" = "bronze/awsglue-datasets/us-legislators/all-persons.json", | ||
"--target-bucket-name" = var.data_bucket_id, | ||
"--target-table-path" = "silver/us-legislators", | ||
} | ||
tags = local.default_tags | ||
default_arguments = each.value.default_arguments | ||
tags = local.default_tags | ||
command { | ||
script_location = "s3://${aws_s3_bucket.glue["scripts"].id}/s3_json_to_parquet_job.py" | ||
script_location = each.value.script_location | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters