Skip to content

Commit 8a50f81

Browse files
committed
NRL-1320 update infra to version source bucket and allow for notebook creation in glue
1 parent 86d8ad1 commit 8a50f81

File tree

4 files changed

+63
-3
lines changed

4 files changed

+63
-3
lines changed

terraform/account-wide-infrastructure/modules/glue/glue.tf

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ resource "aws_glue_crawler" "log_crawler" {
4040
path = "${aws_s3_bucket.target-data-bucket.id}/producer_updateDocumentReference/"
4141
}
4242
s3_target {
43-
path = "${aws_s3_bucket.target-data-bucket.id}/producer_upsertDocumentReference//"
43+
path = "${aws_s3_bucket.target-data-bucket.id}/producer_upsertDocumentReference/"
44+
}
45+
s3_target {
46+
path = "${aws_s3_bucket.source-data-bucket.id}/2025/"
4447
}
4548
schema_change_policy {
4649
delete_behavior = "LOG"
@@ -64,10 +67,10 @@ resource "aws_glue_job" "glue_job" {
6467
name = "${var.name_prefix}-glue-job"
6568
role_arn = aws_iam_role.glue_service_role.arn
6669
description = "Transfer logs from source to bucket"
67-
glue_version = "4.0"
70+
glue_version = "5.0"
6871
worker_type = "G.1X"
6972
timeout = 2880
70-
max_retries = 1
73+
max_retries = 0
7174
number_of_workers = 2
7275
command {
7376
name = "glueetl"

terraform/account-wide-infrastructure/modules/glue/iam.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,16 @@ data "aws_iam_policy_document" "glue_service" {
8080

8181
effect = "Allow"
8282
}
83+
84+
statement {
85+
actions = [
86+
"iam:PassRole",
87+
]
88+
effect = "Allow"
89+
resources = [
90+
"*"
91+
]
92+
}
8393
}
8494

8595
resource "aws_iam_policy" "glue_service" {
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
locals {
2+
s3 = {
3+
transition_storage = {
4+
infrequent_access = {
5+
storage_class = "STANDARD_IA"
6+
days = 150
7+
}
8+
glacier = {
9+
storage_class = "GLACIER"
10+
days = 200
11+
}
12+
}
13+
14+
expiration = {
15+
days = 1095
16+
}
17+
}
18+
}

terraform/account-wide-infrastructure/modules/glue/s3.tf

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,35 @@ resource "aws_s3_bucket_public_access_block" "source-data-bucket-public-access-b
5151
restrict_public_buckets = true
5252
}
5353

54+
resource "aws_s3_bucket_lifecycle_configuration" "source-data-bucket-lifecycle" {
55+
bucket = aws_s3_bucket.source-data-bucket.id
56+
57+
58+
rule {
59+
id = "bucket-versioning-rule"
60+
status = "Enabled"
61+
62+
transition {
63+
days = local.s3.transition_storage.infrequent_access.days
64+
storage_class = local.s3.transition_storage.infrequent_access.storage_class
65+
}
66+
transition {
67+
days = local.s3.transition_storage.glacier.days
68+
storage_class = local.s3.transition_storage.glacier.storage_class
69+
}
70+
expiration {
71+
days = local.s3.expiration.days
72+
}
73+
}
74+
}
75+
76+
resource "aws_s3_bucket_versioning" "source-data-bucket-versioning" {
77+
bucket = aws_s3_bucket.source-data-bucket.id
78+
versioning_configuration {
79+
status = "Enabled"
80+
}
81+
}
82+
5483

5584
# S3 Bucket for Processed Data
5685
resource "aws_s3_bucket" "target-data-bucket" {

0 commit comments

Comments
 (0)