Skip to content

Commit

Permalink
Updated marketplace bucket tags and added bucket name to ssm paramete…
Browse files Browse the repository at this point in the history
…r. (#465)
  • Loading branch information
ngachung authored Dec 2, 2024
1 parent 5bafa7f commit ad58a7d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 19 deletions.
33 changes: 26 additions & 7 deletions tf-module/marketplace/s3_bucket_creation.tf
Original file line number Diff line number Diff line change
@@ -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
}
Expand All @@ -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
Expand Down Expand Up @@ -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
}
13 changes: 1 addition & 12 deletions tf-module/marketplace/terraform.tfvars.example
Original file line number Diff line number Diff line change
Expand Up @@ -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"
uds_prefix_ssm_path="/unity/shared-services/data-catalog/deployment/prefix"

0 comments on commit ad58a7d

Please sign in to comment.