Skip to content

Commit

Permalink
move bucket creation out of liberator module (#1498)
Browse files Browse the repository at this point in the history
* move bucket creation back to db-snapshot-to-s3 module

* Revert "move bucket creation back to db-snapshot-to-s3 module"

This reverts commit 7325d3c.

* recreate liberator_db_snapshot_to_s3 module
add bucket creation back to db-snapshot-to-s3 module
remove associated bucket from core

* move bucket from liberator_db_snapshot_to_s3 to seperate resource
  • Loading branch information
timburke-hackit authored Nov 9, 2023
1 parent e6d6155 commit d5dabac
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 12 deletions.
28 changes: 28 additions & 0 deletions terraform/core/36-liberator-import.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,29 @@ module "liberator_dump_to_rds_snapshot" {
vpc_id = data.aws_vpc.network.id
}

module "liberator_db_snapshot_to_s3" {
count = 1
source = "../modules/db-snapshot-to-s3"
tags = module.tags.values
project = var.project
environment = var.environment
identifier_prefix = "${local.identifier_prefix}-dp"
lambda_artefact_storage_bucket = module.lambda_artefact_storage.bucket_id
zone_kms_key_arn = module.landing_zone.kms_key_arn
zone_bucket_arn = module.landing_zone.bucket_arn
zone_bucket_id = module.landing_zone.bucket_id
rds_export_storage_bucket_arn = module.rds_export_storage.bucket_arn
rds_export_storage_bucket_id = module.rds_export_storage.bucket_id
rds_export_storage_kms_key_arn = module.rds_export_storage.kms_key_arn
rds_export_storage_kms_key_id = module.rds_export_storage.kms_key_id
service_area = "parking"
rds_instance_ids = [for item in module.liberator_dump_to_rds_snapshot : item.rds_instance_id]
workflow_name = aws_glue_workflow.parking_liberator_data.name
workflow_arn = aws_glue_workflow.parking_liberator_data.arn
backdated_workflow_name = aws_glue_workflow.parking_liberator_backdated_data.name
backdated_workflow_arn = aws_glue_workflow.parking_liberator_backdated_data.arn
}

resource "aws_glue_workflow" "parking_liberator_data" {
# Components for this workflow are managed mainly in etl/38-aws-glue-job-parking.tf by parking officers
# There are couple of other resources that are part of the ingestion process, but the core ETL configuration is in the file mentioned above
Expand Down Expand Up @@ -82,3 +105,8 @@ module "liberator_rds_snapshot_to_s3" {
backdated_workflow_name = aws_glue_workflow.parking_liberator_backdated_data.name
backdated_workflow_arn = aws_glue_workflow.parking_liberator_backdated_data.arn
}

moved {
from = module.liberator_db_snapshot_to_s3[0].module.rds_export_storage.aws_s3_bucket.bucket_id
to = module.deprecated_rds_export_storage.aws_s3_bucket.bucket_id
}
12 changes: 0 additions & 12 deletions terraform/modules/db-snapshot-to-s3/10-s3.tf
Original file line number Diff line number Diff line change
@@ -1,13 +1 @@
module "rds_export_storage" {
source = "../s3-bucket"

tags = var.tags
project = var.project
environment = var.environment
identifier_prefix = var.identifier_prefix
bucket_name = "RDS Export Storage"
bucket_identifier = "rds-export-storage${var.aws_account_suffix}"
role_arns_to_share_access_with = [
aws_iam_role.rds_snapshot_to_s3_lambda.arn
]
}

0 comments on commit d5dabac

Please sign in to comment.