diff --git a/tf-module/marketplace/s3_bucket_creation.tf b/tf-module/marketplace/s3_bucket_creation.tf index 258d7ed..91307af 100644 --- a/tf-module/marketplace/s3_bucket_creation.tf +++ b/tf-module/marketplace/s3_bucket_creation.tf @@ -1,3 +1,21 @@ +locals { + bucket_tags = merge( + var.tags, + { + "Proj" = var.project + "Venue" = var.venue + "Env" = var.venue + "ServiceArea" = "ds" + "CapVersion" = "1.0.0" + "Component" = "MarketplaceBucket" + "CreatedBy" = "ds" + "Stack" = "MarketplaceBucket" + "Capability" = "data-storage" + "Name" = "${var.project}-${var.venue}-ds-data-storage-marketplace-bucket" + } + ) +} + data "aws_ssm_parameter" "uds_aws_account" { name = var.uds_aws_account_ssm_path } @@ -11,13 +29,7 @@ data "aws_ssm_parameter" "uds_prefix" { } resource "aws_s3_bucket" "market_bucket" { bucket = lower(replace("${var.project}-${var.venue}-unity-${var.market_bucket_name}", "_", "-")) - tags = merge( - var.tags, - { - "project" = var.project - "venue" = var.venue - } - ) + tags = local.bucket_tags } resource "aws_s3_bucket_server_side_encryption_configuration" "market_bucket" { // https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_server_side_encryption_configuration @@ -48,4 +60,11 @@ resource "aws_s3_bucket_notification" "bucket_notification" { filter_suffix = ".json" filter_prefix = var.market_bucket__notification_prefix } +} + +resource "aws_ssm_parameter" "primary_data_bucket" { + name = "/unity/ds/data/bucket/primary-data-bucket" + type = "String" + value = aws_s3_bucket.market_bucket.bucket + tags = local.bucket_tags } \ No newline at end of file diff --git a/tf-module/marketplace/terraform.tfvars.example b/tf-module/marketplace/terraform.tfvars.example index a886c79..1df5bea 100644 --- a/tf-module/marketplace/terraform.tfvars.example +++ b/tf-module/marketplace/terraform.tfvars.example @@ -2,17 +2,6 @@ project = "Unity" venue = "dev" market_bucket_name = "william_test_1" market_bucket__notification_prefix = "stage_out" -tags = { - Venue = "test", - ServiceArea = "ds", - CapVersion = "18.3.3" - Component = "Cumulus", - Proj = "Unity", - CreatedBy = "ds", - Env = "test", - Stack = "Cumulus" -} uds_aws_account_ssm_path="/unity/shared-services/aws/account" uds_aws_account_region_ssm_path="/unity/shared-services/aws/account/region" -uds_prefix_ssm_path="/unity/shared-services/data-catalog/deployment/prefix" -cumulus_lambda_processing_role_name_postfix="lambda-processing" \ No newline at end of file +uds_prefix_ssm_path="/unity/shared-services/data-catalog/deployment/prefix" \ No newline at end of file