diff --git a/deploy/terraform/apprunner/providers.tf b/deploy/terraform/apprunner/providers.tf index a05e86a29..870fd53a6 100644 --- a/deploy/terraform/apprunner/providers.tf +++ b/deploy/terraform/apprunner/providers.tf @@ -1,7 +1,7 @@ terraform { required_providers { aws = { - source = "hashicorp/aws" + source = "hashicorp/aws" } } } diff --git a/deploy/terraform/apprunner/variables.tf b/deploy/terraform/apprunner/variables.tf index 3f7d9e049..f17ea337b 100644 --- a/deploy/terraform/apprunner/variables.tf +++ b/deploy/terraform/apprunner/variables.tf @@ -1,6 +1,7 @@ variable "environment_name" { - type = string - default = "retail-store-ar" + type = string + default = "retail-store-ar" + description = "Name of the environment" } variable "container_image_overrides" { @@ -10,6 +11,7 @@ variable "container_image_overrides" { } variable "image_repository_type" { + type = string description = "The type of image repository where the images will be pulled from" default = "ECR_PUBLIC" } diff --git a/deploy/terraform/ecs/default/providers.tf b/deploy/terraform/ecs/default/providers.tf index a05e86a29..870fd53a6 100644 --- a/deploy/terraform/ecs/default/providers.tf +++ b/deploy/terraform/ecs/default/providers.tf @@ -1,7 +1,7 @@ terraform { required_providers { aws = { - source = "hashicorp/aws" + source = "hashicorp/aws" } } } diff --git a/deploy/terraform/ecs/default/variables.tf b/deploy/terraform/ecs/default/variables.tf index c229743cb..f8151480c 100644 --- a/deploy/terraform/ecs/default/variables.tf +++ b/deploy/terraform/ecs/default/variables.tf @@ -1,6 +1,7 @@ variable "environment_name" { - type = string - default = "retail-store-ecs" + type = string + default = "retail-store-ecs" + description = "Name of the environment" } variable "container_image_overrides" { diff --git a/deploy/terraform/lib/apprunner/carts.tf b/deploy/terraform/lib/apprunner/carts.tf index 2289d4746..3a6fc41e8 100644 --- a/deploy/terraform/lib/apprunner/carts.tf +++ b/deploy/terraform/lib/apprunner/carts.tf @@ -10,7 +10,7 @@ module "app_runner_carts" { port = 8080 runtime_environment_variables = { CARTS_DYNAMODB_TABLENAME = var.carts_dynamodb_table_name - SPRING_PROFILES_ACTIVE = "dynamodb" + SPRING_PROFILES_ACTIVE = "dynamodb" } } image_identifier = module.container_images.result.cart.url diff --git a/deploy/terraform/lib/apprunner/outputs.tf b/deploy/terraform/lib/apprunner/outputs.tf index 10347d3c3..5e8da946a 100644 --- a/deploy/terraform/lib/apprunner/outputs.tf +++ b/deploy/terraform/lib/apprunner/outputs.tf @@ -5,12 +5,15 @@ output "ui_service_url" { output "catalog_security_group_id" { value = aws_security_group.catalog.id + description = "Security group ID of the catalog service" } output "checkout_security_group_id" { value = aws_security_group.checkout.id + description = "Security group ID of the checkout service" } output "orders_security_group_id" { value = aws_security_group.orders.id + description = "Security group ID of the orders service" } \ No newline at end of file diff --git a/deploy/terraform/lib/apprunner/variables.tf b/deploy/terraform/lib/apprunner/variables.tf index 3b3fe9977..8c296f64b 100644 --- a/deploy/terraform/lib/apprunner/variables.tf +++ b/deploy/terraform/lib/apprunner/variables.tf @@ -1,10 +1,12 @@ variable "environment_name" { - type = string + type = string + description = "Name of the environment" } variable "tags" { description = "List of tags to be associated with resources." default = {} + type = any } variable "vpc_id" { @@ -12,11 +14,6 @@ variable "vpc_id" { type = string } -variable "vpc_cidr" { - description = "VPC ID used to create EKS cluster." - type = string -} - variable "subnet_ids" { description = "List of private subnet IDs used by EKS cluster nodes." type = list(string) @@ -25,6 +22,7 @@ variable "subnet_ids" { variable "image_repository_type" { description = "The type of image repository where the images will be pulled from" default = "ECR_PUBLIC" + type = string } variable "container_image_overrides" { @@ -34,69 +32,86 @@ variable "container_image_overrides" { } variable "catalog_db_endpoint" { - type = string + type = string + description = "Endpoint of the catalog database" } variable "catalog_db_port" { - type = string + type = string + description = "Port of the catalog database" } variable "catalog_db_name" { - type = string + type = string + description = "Name of the catalog database" } variable "catalog_db_username" { - type = string + type = string + description = "Username for the catalog database" } variable "catalog_db_password" { - type = string + type = string + description = "Password for the catalog database" } variable "carts_dynamodb_table_name" { - type = string + type = string + description = "DynamoDB table name for the carts service" } variable "carts_dynamodb_policy_arn" { - type = string + type = string + description = "IAM policy for DynamoDB table for the carts service" } variable "orders_db_endpoint" { - type = string + type = string + description = "Endpoint of the orders database" } variable "orders_db_port" { - type = string + type = string + description = "Port of the orders database" } variable "orders_db_name" { - type = string + type = string + description = "Name of the orders database" } variable "orders_db_username" { - type = string + type = string + description = "Username for the orders database" } variable "orders_db_password" { - type = string + type = string + description = "Username for the password database" } variable "checkout_redis_endpoint" { - type = string + type = string + description = "Endpoint of the checkout redis" } variable "checkout_redis_port" { - type = string + type = string + description = "Port of the checkout redis" } variable "mq_endpoint" { - type = string + type = string + description = "Endpoint of the shared MQ" } variable "mq_username" { - type = string + type = string + description = "Username for the shared MQ" } variable "mq_password" { - type = string + type = string + description = "Password for the shared MQ" } diff --git a/deploy/terraform/lib/dependencies/catalog_rds.tf b/deploy/terraform/lib/dependencies/catalog_rds.tf index a8486b0cb..524594c94 100644 --- a/deploy/terraform/lib/dependencies/catalog_rds.tf +++ b/deploy/terraform/lib/dependencies/catalog_rds.tf @@ -2,17 +2,17 @@ module "catalog_rds" { source = "terraform-aws-modules/rds-aurora/aws" version = "7.7.1" - name = "${var.environment_name}-catalog" - engine = "aurora-mysql" - engine_version = "8.0" - instance_class = "db.t3.medium" + name = "${var.environment_name}-catalog" + engine = "aurora-mysql" + engine_version = "8.0" + instance_class = "db.t3.medium" allow_major_version_upgrade = true instances = { one = {} } - vpc_id = var.vpc_id + vpc_id = var.vpc_id subnets = var.subnet_ids allowed_security_groups = concat(var.allowed_security_group_ids, [var.catalog_security_group_id]) @@ -32,7 +32,7 @@ module "catalog_rds" { db_cluster_parameter_group_name = "${var.environment_name}-catalog" db_cluster_parameter_group_family = "aurora-mysql8.0" - tags = var.tags + tags = var.tags } resource "random_string" "catalog_db_master" { diff --git a/deploy/terraform/lib/dependencies/dynamodb.tf b/deploy/terraform/lib/dependencies/dynamodb.tf index a97c0775e..8d4719ccd 100644 --- a/deploy/terraform/lib/dependencies/dynamodb.tf +++ b/deploy/terraform/lib/dependencies/dynamodb.tf @@ -1,4 +1,4 @@ -module "dynamodb-carts" { +module "dynamodb_carts" { source = "terraform-aws-modules/dynamodb-table/aws" version = "3.2.0" @@ -41,8 +41,8 @@ resource "aws_iam_policy" "carts_dynamo" { "Effect": "Allow", "Action": "dynamodb:*", "Resource": [ - "arn:${local.aws_partition}:dynamodb:${local.aws_region}:${local.aws_account_id}:table/${module.dynamodb-carts.dynamodb_table_id}", - "arn:${local.aws_partition}:dynamodb:${local.aws_region}:${local.aws_account_id}:table/${module.dynamodb-carts.dynamodb_table_id}/index/*" + "arn:${local.aws_partition}:dynamodb:${local.aws_region}:${local.aws_account_id}:table/${module.dynamodb_carts.dynamodb_table_id}", + "arn:${local.aws_partition}:dynamodb:${local.aws_region}:${local.aws_account_id}:table/${module.dynamodb_carts.dynamodb_table_id}/index/*" ] } ] diff --git a/deploy/terraform/lib/dependencies/elasticache.tf b/deploy/terraform/lib/dependencies/elasticache.tf index 1c501f445..ff584fb71 100644 --- a/deploy/terraform/lib/dependencies/elasticache.tf +++ b/deploy/terraform/lib/dependencies/elasticache.tf @@ -1,4 +1,4 @@ -module "checkout-elasticache-redis" { +module "checkout_elasticache_redis" { source = "cloudposse/elasticache-redis/aws" version = "0.52.0" diff --git a/deploy/terraform/lib/dependencies/main.tf b/deploy/terraform/lib/dependencies/main.tf index 92a41b206..73f6f2953 100644 --- a/deploy/terraform/lib/dependencies/main.tf +++ b/deploy/terraform/lib/dependencies/main.tf @@ -1,7 +1,5 @@ data "aws_region" "current" {} -data "aws_availability_zones" "available" {} - data "aws_caller_identity" "current" {} data "aws_partition" "current" {} diff --git a/deploy/terraform/lib/dependencies/outputs.tf b/deploy/terraform/lib/dependencies/outputs.tf index 921323448..dbdc1c086 100644 --- a/deploy/terraform/lib/dependencies/outputs.tf +++ b/deploy/terraform/lib/dependencies/outputs.tf @@ -74,12 +74,12 @@ output "orders_db_arn" { output "carts_dynamodb_table_arn" { description = "ARN of the carts DynamoDB table" - value = module.dynamodb-carts.dynamodb_table_arn + value = module.dynamodb_carts.dynamodb_table_arn } output "carts_dynamodb_table_name" { description = "Name of the carts DynamoDB table" - value = module.dynamodb-carts.dynamodb_table_id + value = module.dynamodb_carts.dynamodb_table_id } output "carts_dynamodb_policy_arn" { @@ -114,21 +114,21 @@ output "mq_user" { } output "checkout_elasticache_arn" { - value = module.checkout-elasticache-redis.arn + value = module.checkout_elasticache_redis.arn description = "Checkout Redis ElastiCache ARN." } output "checkout_elasticache_primary_endpoint" { - value = module.checkout-elasticache-redis.endpoint + value = module.checkout_elasticache_redis.endpoint description = "Checkout Redis hostname" } output "checkout_elasticache_reader_endpoint" { - value = module.checkout-elasticache-redis.reader_endpoint_address + value = module.checkout_elasticache_redis.reader_endpoint_address description = "Checkout Redis reader hostname" } output "checkout_elasticache_port" { - value = module.checkout-elasticache-redis.port + value = module.checkout_elasticache_redis.port description = "Checkout Redis port" } diff --git a/deploy/terraform/lib/dependencies/variables.tf b/deploy/terraform/lib/dependencies/variables.tf index e4a5534e7..b30c11e8c 100644 --- a/deploy/terraform/lib/dependencies/variables.tf +++ b/deploy/terraform/lib/dependencies/variables.tf @@ -1,9 +1,11 @@ variable "environment_name" { - type = string + type = string + description = "Name of the environment" } variable "vpc_id" { - type = string + type = string + description = "VPC ID for the resources" } variable "subnet_ids" { @@ -12,27 +14,28 @@ variable "subnet_ids" { } variable "tags" { - description = "A map of tags to add to all resources" + description = "List of tags to be associated with resources." default = {} -} - -variable "availability_zones" { - type = list(string) + type = any } variable "catalog_security_group_id" { - type = string + type = string + description = "Security group ID of the catalog component" } variable "orders_security_group_id" { - type = string + type = string + description = "Security group ID of the orders component" } variable "checkout_security_group_id" { - type = string + type = string + description = "Security group ID of the checkout component" } variable "allowed_security_group_ids" { - type = list(string) - default = [] + type = list(string) + default = [] + description = "List of additional allowed security group IDs" } \ No newline at end of file diff --git a/deploy/terraform/lib/ecs/common.tf b/deploy/terraform/lib/ecs/common.tf index 702910b2f..60275346e 100644 --- a/deploy/terraform/lib/ecs/common.tf +++ b/deploy/terraform/lib/ecs/common.tf @@ -4,8 +4,8 @@ resource "aws_kms_key" "cmk" { } resource "random_string" "random_mq_secret" { - length = 4 - special = false + length = 4 + special = false } resource "aws_secretsmanager_secret" "mq" { diff --git a/deploy/terraform/lib/ecs/main.tf b/deploy/terraform/lib/ecs/main.tf index d5f4158c3..7fc7cfc12 100644 --- a/deploy/terraform/lib/ecs/main.tf +++ b/deploy/terraform/lib/ecs/main.tf @@ -3,9 +3,3 @@ module "container_images" { container_image_overrides = var.container_image_overrides } - -data "aws_ssm_parameter" "fluentbit" { - name = "/aws/service/aws-for-fluent-bit/stable" -} - -data "aws_region" "current" {} diff --git a/deploy/terraform/lib/ecs/outputs.tf b/deploy/terraform/lib/ecs/outputs.tf index e99fb27e0..b2d6fe476 100644 --- a/deploy/terraform/lib/ecs/outputs.tf +++ b/deploy/terraform/lib/ecs/outputs.tf @@ -4,13 +4,16 @@ output "ui_service_url" { } output "catalog_security_group_id" { - value = module.catalog_service.task_security_group_id + value = module.catalog_service.task_security_group_id + description = "Security group ID of the catalog service" } output "checkout_security_group_id" { - value = module.checkout_service.task_security_group_id + value = module.checkout_service.task_security_group_id + description = "Security group ID of the checkout service" } output "orders_security_group_id" { - value = module.orders_service.task_security_group_id + value = module.orders_service.task_security_group_id + description = "Security group ID of the orders service" } diff --git a/deploy/terraform/lib/ecs/service/ecs.tf b/deploy/terraform/lib/ecs/service/ecs.tf index da05e231c..1069d21ab 100644 --- a/deploy/terraform/lib/ecs/service/ecs.tf +++ b/deploy/terraform/lib/ecs/service/ecs.tf @@ -97,4 +97,6 @@ resource "aws_ecs_service" "this" { container_port = 8080 } } + + tags = var.tags } diff --git a/deploy/terraform/lib/ecs/service/outputs.tf b/deploy/terraform/lib/ecs/service/outputs.tf index be53f3742..23303f603 100644 --- a/deploy/terraform/lib/ecs/service/outputs.tf +++ b/deploy/terraform/lib/ecs/service/outputs.tf @@ -1,7 +1,11 @@ output "ecs_service_name" { value = aws_ecs_service.this.name + + description = "Name of the ECS service" } output "task_security_group_id" { value = aws_security_group.this.id + + description = "ID of the task security group" } diff --git a/deploy/terraform/lib/ecs/service/variables.tf b/deploy/terraform/lib/ecs/service/variables.tf index 6c7d1116e..b29a6d648 100644 --- a/deploy/terraform/lib/ecs/service/variables.tf +++ b/deploy/terraform/lib/ecs/service/variables.tf @@ -1,9 +1,11 @@ variable "environment_name" { - type = string + type = string + description = "Name of the environment" } variable "service_name" { - type = string + type = string + description = "Name of the ECS service" } variable "cluster_arn" { @@ -14,6 +16,7 @@ variable "cluster_arn" { variable "tags" { description = "List of tags to be associated with resources." default = {} + type = any } variable "vpc_id" { @@ -21,59 +24,58 @@ variable "vpc_id" { type = string } -variable "vpc_cidr" { - description = "VPC CIDR" - type = string -} - variable "subnet_ids" { description = "List of private subnet IDs." type = list(string) } -variable "public_subnet_ids" { - description = "List of public subnet IDs." - type = list(string) -} - variable "container_image" { description = "Container image for the service" + type = string } variable "service_discovery_namespace_arn" { description = "ARN of the service discovery namespace for Service Connect" + type = string } variable "environment_variables" { description = "Map of environment variables for the ECS task" default = {} + type = any } variable "secrets" { description = "Map of secrets for the ECS task" default = {} + type = any } variable "additional_task_role_iam_policy_arns" { description = "Additional IAM policy ARNs to be added to the task role" default = [] + type = list(string) } variable "additional_task_execution_role_iam_policy_arns" { description = "Additional IAM policy ARNs to be added to the task execution role" default = [] + type = list(string) } variable "healthcheck_path" { description = "HTTP path used to health check the service" default = "/health" + type = string } variable "cloudwatch_logs_group_id" { description = "CloudWatch logs group ID" + type = string } variable "alb_target_group_arn" { description = "ARN of the ALB target group the ECS service should register tasks to" default = "" + type = string } diff --git a/deploy/terraform/lib/ecs/variables.tf b/deploy/terraform/lib/ecs/variables.tf index 7ede763e7..eb42fe7ec 100644 --- a/deploy/terraform/lib/ecs/variables.tf +++ b/deploy/terraform/lib/ecs/variables.tf @@ -1,10 +1,12 @@ variable "environment_name" { - type = string + type = string + description = "Name of the environment" } variable "tags" { description = "List of tags to be associated with resources." default = {} + type = any } variable "vpc_id" { @@ -34,69 +36,86 @@ variable "container_image_overrides" { } variable "catalog_db_endpoint" { - type = string + type = string + description = "Endpoint of the catalog database" } variable "catalog_db_port" { - type = string + type = string + description = "Port of the catalog database" } variable "catalog_db_name" { - type = string + type = string + description = "Name of the catalog database" } variable "catalog_db_username" { - type = string + type = string + description = "Username for the catalog database" } variable "catalog_db_password" { - type = string + type = string + description = "Password for the catalog database" } variable "carts_dynamodb_table_name" { - type = string + type = string + description = "DynamoDB table name for the carts service" } variable "carts_dynamodb_policy_arn" { - type = string + type = string + description = "IAM policy for DynamoDB table for the carts service" } variable "orders_db_endpoint" { - type = string + type = string + description = "Endpoint of the orders database" } variable "orders_db_port" { - type = string + type = string + description = "Port of the orders database" } variable "orders_db_name" { - type = string + type = string + description = "Name of the orders database" } variable "orders_db_username" { - type = string + type = string + description = "Username for the orders database" } variable "orders_db_password" { - type = string + type = string + description = "Username for the password database" } variable "checkout_redis_endpoint" { - type = string + type = string + description = "Endpoint of the checkout redis" } variable "checkout_redis_port" { - type = string + type = string + description = "Port of the checkout redis" } variable "mq_endpoint" { - type = string + type = string + description = "Endpoint of the shared MQ" } variable "mq_username" { - type = string + type = string + description = "Username for the shared MQ" } variable "mq_password" { - type = string -} + type = string + description = "Password for the shared MQ" +} \ No newline at end of file diff --git a/deploy/terraform/lib/images/outputs.tf b/deploy/terraform/lib/images/outputs.tf index d3ff28823..758f3cdaa 100644 --- a/deploy/terraform/lib/images/outputs.tf +++ b/deploy/terraform/lib/images/outputs.tf @@ -19,4 +19,6 @@ output "result" { url = local.ui_image }, zipmap(["repository", "tag"], split(":", local.ui_image))) } + + description = "Computed image results" } diff --git a/deploy/terraform/lib/tags/main.tf b/deploy/terraform/lib/tags/main.tf index 51c2dc77d..3cee8ce40 100644 --- a/deploy/terraform/lib/tags/main.tf +++ b/deploy/terraform/lib/tags/main.tf @@ -1,5 +1,6 @@ variable "environment_name" { - type = string + type = string + description = "Name of the environment" } output "result" { @@ -7,4 +8,5 @@ output "result" { environment-name = var.environment_name created-by = "retail-store-sample-app" } + description = "Computed tag results" } \ No newline at end of file diff --git a/deploy/terraform/lib/vpc/outputs.tf b/deploy/terraform/lib/vpc/outputs.tf index 517d178db..41a66a52f 100644 --- a/deploy/terraform/lib/vpc/outputs.tf +++ b/deploy/terraform/lib/vpc/outputs.tf @@ -1,11 +1,14 @@ output "inner" { - value = module.vpc + value = module.vpc + description = "Outputs from the VPC module" } output "availability_zones" { - value = local.azs + value = local.azs + description = "List of availability zones where the VPC was created" } output "vpc_cidr" { - value = var.vpc_cidr + value = var.vpc_cidr + description = "CIDR block of the VPC" } \ No newline at end of file diff --git a/deploy/terraform/lib/vpc/variables.tf b/deploy/terraform/lib/vpc/variables.tf index 8c08e2336..11baaad82 100644 --- a/deploy/terraform/lib/vpc/variables.tf +++ b/deploy/terraform/lib/vpc/variables.tf @@ -1,22 +1,28 @@ variable "environment_name" { - type = string + type = string + description = "Name of the environment" } variable "vpc_cidr" { - type = string - default = "10.0.0.0/16" + type = string + default = "10.0.0.0/16" + description = "CIDR block for the VPC" } variable "public_subnet_tags" { - type = map - default = {} + type = map(any) + default = {} + description = "Additional tags to apply to public subnets" } variable "private_subnet_tags" { - type = map - default = {} + type = map(any) + default = {} + description = "Additional tags to apply to private subnets" } variable "tags" { - default = {} + description = "List of tags to be associated with resources." + default = {} + type = any } \ No newline at end of file