From d1da4c6da72e2e58372b8fcb45473ba59283a559 Mon Sep 17 00:00:00 2001 From: Galen Hollins <47542238+galenatjpl@users.noreply.github.com> Date: Wed, 11 Dec 2024 14:11:43 -0800 Subject: [PATCH] updated name spaces and naming of resources (#482) --- tf-module/marketplace/outputs.tf | 4 +-- tf-module/marketplace/s3_bucket_creation.tf | 32 +++++++++---------- .../marketplace/terraform.tfvars.example | 4 +-- tf-module/marketplace/variables.tf | 8 ++--- tf-module/unity-cumulus/variables.tf | 4 +-- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/tf-module/marketplace/outputs.tf b/tf-module/marketplace/outputs.tf index 9c7661e8..c1fe2db9 100644 --- a/tf-module/marketplace/outputs.tf +++ b/tf-module/marketplace/outputs.tf @@ -1,3 +1,3 @@ -output "market_bucket_name" { - value = aws_s3_bucket.market_bucket.id +output "datastore_bucket_name" { + value = aws_s3_bucket.datastore_bucket.id } \ No newline at end of file diff --git a/tf-module/marketplace/s3_bucket_creation.tf b/tf-module/marketplace/s3_bucket_creation.tf index 91307af8..0664f028 100644 --- a/tf-module/marketplace/s3_bucket_creation.tf +++ b/tf-module/marketplace/s3_bucket_creation.tf @@ -7,11 +7,11 @@ locals { "Env" = var.venue "ServiceArea" = "ds" "CapVersion" = "1.0.0" - "Component" = "MarketplaceBucket" + "Component" = "DatastoreBucket" "CreatedBy" = "ds" - "Stack" = "MarketplaceBucket" - "Capability" = "data-storage" - "Name" = "${var.project}-${var.venue}-ds-data-storage-marketplace-bucket" + "Stack" = "DatastoreBucket" + "Capability" = "datastore" + "Name" = "${var.project}-${var.venue}-ds-datastore-bucket" } ) } @@ -27,13 +27,13 @@ data "aws_ssm_parameter" "uds_aws_account_region" { data "aws_ssm_parameter" "uds_prefix" { name = "arn:aws:ssm:${data.aws_ssm_parameter.uds_aws_account_region.value}:${data.aws_ssm_parameter.uds_aws_account.value}:parameter${var.uds_prefix_ssm_path}" } -resource "aws_s3_bucket" "market_bucket" { - bucket = lower(replace("${var.project}-${var.venue}-unity-${var.market_bucket_name}", "_", "-")) +resource "aws_s3_bucket" "datastore_bucket" { + bucket = lower(replace("${var.project}-${var.venue}-unity-${var.datastore_bucket_name}", "_", "-")) 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 - bucket = aws_s3_bucket.market_bucket.id +resource "aws_s3_bucket_server_side_encryption_configuration" "datastore_bucket" { // https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_server_side_encryption_configuration + bucket = aws_s3_bucket.datastore_bucket.id rule { apply_server_side_encryption_by_default { sse_algorithm = "AES256" @@ -41,30 +41,30 @@ resource "aws_s3_bucket_server_side_encryption_configuration" "market_bucket" { } } -resource "aws_s3_bucket_policy" "market_bucket" { +resource "aws_s3_bucket_policy" "datastore_bucket" { // https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_policy - bucket = aws_s3_bucket.market_bucket.id + bucket = aws_s3_bucket.datastore_bucket.id policy = templatefile("${path.module}/s3_bucket_policy.json", { udsAwsAccount: data.aws_ssm_parameter.uds_aws_account.value, - s3BucketName: aws_s3_bucket.market_bucket.id, + s3BucketName: aws_s3_bucket.datastore_bucket.id, cumulus_lambda_processing_role_name: "${data.aws_ssm_parameter.uds_prefix.value}-${var.cumulus_lambda_processing_role_name_postfix}", cumulus_sf_lambda_role_name: "${data.aws_ssm_parameter.uds_prefix.value}${var.cumulus_sf_lambda_role_name_postfix}", }) } resource "aws_s3_bucket_notification" "bucket_notification" { - bucket = aws_s3_bucket.market_bucket.id + bucket = aws_s3_bucket.datastore_bucket.id topic { topic_arn = "arn:aws:sns:${data.aws_ssm_parameter.uds_aws_account_region.value}:${data.aws_ssm_parameter.uds_aws_account.value}:${data.aws_ssm_parameter.uds_prefix.value}-granules_cnm_ingester" events = ["s3:ObjectCreated:*"] filter_suffix = ".json" - filter_prefix = var.market_bucket__notification_prefix + filter_prefix = var.datastore_bucket_notification_prefix } } -resource "aws_ssm_parameter" "primary_data_bucket" { - name = "/unity/ds/data/bucket/primary-data-bucket" +resource "aws_ssm_parameter" "datastore_bucket" { + name = "/unity/${var.project}/${var.venue}/ds/datastore-bucket" type = "String" - value = aws_s3_bucket.market_bucket.bucket + value = aws_s3_bucket.datastore_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 1df5bea3..aa150cbc 100644 --- a/tf-module/marketplace/terraform.tfvars.example +++ b/tf-module/marketplace/terraform.tfvars.example @@ -1,7 +1,7 @@ project = "Unity" venue = "dev" -market_bucket_name = "william_test_1" -market_bucket__notification_prefix = "stage_out" +datastore_bucket_name = "william_test_1" +datastore_bucket_notification_prefix = "stage_out" 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" \ No newline at end of file diff --git a/tf-module/marketplace/variables.tf b/tf-module/marketplace/variables.tf index fc6218c4..d2594963 100644 --- a/tf-module/marketplace/variables.tf +++ b/tf-module/marketplace/variables.tf @@ -1,12 +1,12 @@ variable "installprefix" { type = string default = "" - description = "This is not needed, but required by UCS marketplace. Empty string is good enough for manual deployment" + description = "This is not needed, but required by UCS Marketplace. Empty string is good enough for manual deployment" } variable "deployment_name" { type = string default = "" - description = "This is not needed, but required by UCS marketplace. Empty string is good enough for manual deployment" + description = "This is not needed, but required by UCS Marketplace. Empty string is good enough for manual deployment" } variable "project" { type = string @@ -23,11 +23,11 @@ variable "tags" { type = map(string) default = {} } -variable "market_bucket_name" { +variable "datastore_bucket_name" { type = string description = "name of S3 bucket. Note-1: it will be prefixed with '--unity-'. Note-2: It should only have '-'. '_' will be replaced with '-'" } -variable "market_bucket__notification_prefix" { +variable "datastore_bucket_notification_prefix" { type = string default = "stage_out" description = "path to the directory where catalogs.json will be written" diff --git a/tf-module/unity-cumulus/variables.tf b/tf-module/unity-cumulus/variables.tf index ee5e2bf1..04508a25 100644 --- a/tf-module/unity-cumulus/variables.tf +++ b/tf-module/unity-cumulus/variables.tf @@ -176,13 +176,13 @@ variable "cors_integration_response" { variable "health_check_marketplace_item" { type = string default = "shared-services" - description = "name of the portion of market place item as path of SSM token" + description = "name of the portion of Marketplace item as path of SSM token" } variable "health_check_component_name" { type = string default = "data-catalog" - description = "name of the portion of market place item as path of SSM token" + description = "name of the portion of Marketplace item as path of SSM token" } variable "is_deploying_healthcheck" {