Skip to content

feat: updated name spaces and naming of resources #482

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tf-module/marketplace/outputs.tf
Original file line number Diff line number Diff line change
@@ -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
}
32 changes: 16 additions & 16 deletions tf-module/marketplace/s3_bucket_creation.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
)
}
Expand All @@ -27,44 +27,44 @@ 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"
}
}
}

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
}
4 changes: 2 additions & 2 deletions tf-module/marketplace/terraform.tfvars.example
Original file line number Diff line number Diff line change
@@ -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"
8 changes: 4 additions & 4 deletions tf-module/marketplace/variables.tf
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 '<project prefix>-<project venue>-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"
Expand Down
4 changes: 2 additions & 2 deletions tf-module/unity-cumulus/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down
Loading