Skip to content

Commit

Permalink
ADD Archive code and code cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
ramesh-maddegoda committed Aug 1, 2024
1 parent 434ede5 commit be23f25
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 281 deletions.
6 changes: 5 additions & 1 deletion terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,9 @@ module "test-data" {
depends_on = [module.common, module.ecs_ecr]
}


module "test-data" {
source = "./terraform-modules/archive"
pds_node_names = var.pds_node_names
depends_on = [module.common, module.ecs_ecr]
}

15 changes: 15 additions & 0 deletions terraform/terraform-modules/archive/archive.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Terraform script to create the PDS archive related resources

# Create a hot S3 archive bucket for each PDS Node
resource "aws_s3_bucket" "pds_nucleus_hot_archive_bucket" {
count = length(var.pds_node_names)
# convert PDS node name to S3 bucket name compatible format
bucket = "${lower(replace(var.pds_node_names[count.index], "_", "-"))}-${var.pds_nucleus_archive_hot_bucket_name_postfix}"
}

# Create a hot S3 archive bucket for each PDS Node
resource "aws_s3_bucket" "pds_nucleus_col_archive_bucket" {
count = length(var.pds_node_names)
# convert PDS node name to S3 bucket name compatible format
bucket = "${lower(replace(var.pds_node_names[count.index], "_", "-"))}-${var.pds_nucleus_archive_cold_bucket_name_postfix}"
}
25 changes: 25 additions & 0 deletions terraform/terraform-modules/archive/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
variable "pds_node_names" {
description = "List of PDS Node Names"
type = list(string)
sensitive = true
}

variable "pds_nucleus_archive_hot_bucket_name_postfix" {
description = "The postfix of the name of the S3 archive hot bucket to receive data to be processed"
default = "archive-hot-<venue-name>"
type = string
sensitive = true
}

variable "pds_nucleus_archive_cold_bucket_name_postfix" {
description = "The postfix of the name of the S3 archive cold bucket to receive data to be processed"
default = "archive-hot-<venue-name>"
type = string
sensitive = true
}






28 changes: 14 additions & 14 deletions terraform/terraform-modules/common/common.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ resource "aws_security_group" "nucleus_security_group" {
vpc_id = var.vpc_id

ingress {
from_port = 0
to_port = 0
protocol = -1
self = true
from_port = 2049
to_port = 2049
protocol = "tcp"
self = true
}

egress {
Expand All @@ -22,25 +22,25 @@ resource "aws_security_group" "nucleus_security_group" {
}

resource "aws_s3_bucket" "pds_nucleus_airflow_dags_bucket" {
bucket = var.mwaa_dag_s3_bucket_name
# force_destroy = true
bucket = var.mwaa_dag_s3_bucket_name
# force_destroy = true
}

resource "aws_s3_object" "dags" {
bucket = aws_s3_bucket.pds_nucleus_airflow_dags_bucket.id
acl = "private"
key = "dags/"
source = "/dev/null"
bucket = aws_s3_bucket.pds_nucleus_airflow_dags_bucket.id
acl = "private"
key = "dags/"
source = "/dev/null"

depends_on = [aws_s3_bucket.pds_nucleus_airflow_dags_bucket]
}

resource "aws_s3_object" "requirements" {

bucket = aws_s3_bucket.pds_nucleus_airflow_dags_bucket.id
key = "requirements.txt"
acl = "private"
source = "./terraform-modules/mwaa-env/requirements.txt"
bucket = aws_s3_bucket.pds_nucleus_airflow_dags_bucket.id
key = "requirements.txt"
acl = "private"
source = "./terraform-modules/mwaa-env/requirements.txt"

depends_on = [aws_s3_bucket.pds_nucleus_airflow_dags_bucket]
}
Expand Down
26 changes: 0 additions & 26 deletions terraform/terraform-modules/ecs-ecr/docker/deploy-ecr-images.sh

This file was deleted.

This file was deleted.

55 changes: 0 additions & 55 deletions terraform/terraform-modules/ecs-ecr/ecs_task_role_iam_policy.json

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,12 @@ resource "aws_lambda_function" "pds_nucleus_s3_file_file_event_processor_functio
}
}
}

# Create CloudWatch Log Group for pds_nucleus_s3_file_file_event_processor_function for each PDS Node
resource "aws_cloudwatch_log_group" "pds_nucleus_s3_file_file_event_processor_function_log_group" {
count = length(var.pds_node_names)
name = "/aws/lambda/pds_nucleus_s3_file_event_processor-${var.pds_node_names[count.index]}"
}
#
## Create CloudWatch Log Group for pds_nucleus_s3_file_file_event_processor_function for each PDS Node
#resource "aws_cloudwatch_log_group" "pds_nucleus_s3_file_file_event_processor_function_log_group" {
# count = length(var.pds_node_names)
# name = "/aws/lambda/pds_nucleus_s3_file_event_processor-${var.pds_node_names[count.index]}"
#}

# Create SQS queue event source for pds_nucleus_s3_file_file_event_processor_function for each PDS Node
resource "aws_lambda_event_source_mapping" "event_source_mapping" {
Expand Down

0 comments on commit be23f25

Please sign in to comment.