From d5dabac4e5c2f3b1c88ef444238d4c9524ab3256 Mon Sep 17 00:00:00 2001 From: timburke-hackit <61045197+timburke-hackit@users.noreply.github.com> Date: Thu, 9 Nov 2023 12:48:59 +0000 Subject: [PATCH] move bucket creation out of liberator module (#1498) * move bucket creation back to db-snapshot-to-s3 module * Revert "move bucket creation back to db-snapshot-to-s3 module" This reverts commit 7325d3c52d024a830878de7f719f902ee336dcd1. * 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 --- terraform/core/36-liberator-import.tf | 28 ++++++++++++++++++++ terraform/modules/db-snapshot-to-s3/10-s3.tf | 12 --------- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/terraform/core/36-liberator-import.tf b/terraform/core/36-liberator-import.tf index a0ebd68e4..8d3f44992 100644 --- a/terraform/core/36-liberator-import.tf +++ b/terraform/core/36-liberator-import.tf @@ -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 @@ -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 +} diff --git a/terraform/modules/db-snapshot-to-s3/10-s3.tf b/terraform/modules/db-snapshot-to-s3/10-s3.tf index 63c4812ac..8b1378917 100644 --- a/terraform/modules/db-snapshot-to-s3/10-s3.tf +++ b/terraform/modules/db-snapshot-to-s3/10-s3.tf @@ -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 - ] -}