diff --git a/deploy/tf/ecs/alb.tf b/deploy/tf/ecs/alb.tf index 0dd9c69..946355c 100644 --- a/deploy/tf/ecs/alb.tf +++ b/deploy/tf/ecs/alb.tf @@ -1,5 +1,5 @@ resource "aws_lb_target_group" "app" { - name = "sample-django-app" + name = "${var.app_name}-${var.environment}" port = 80 protocol = "HTTP" target_type = "ip" diff --git a/deploy/tf/ecs/ecs.tf b/deploy/tf/ecs/ecs.tf index cfab5c6..fe181ba 100644 --- a/deploy/tf/ecs/ecs.tf +++ b/deploy/tf/ecs/ecs.tf @@ -19,7 +19,7 @@ module "ecs" { version = "~> 5.7.0" # Cluster Configuration - cluster_name = "sample-django-app-${var.environment}" + cluster_name = "${var.app_name}-${var.environment}" cluster_configuration = { name = "containerInsights" value = "enabled" @@ -41,7 +41,7 @@ module "ecs" { # Service Configuration services = { - "sample-django-app-${var.environment}" = { + "${var.app_name}-${var.environment}" = { capacity_provider_strategy = { dedicated = { base = 0 diff --git a/deploy/tf/ecs/variables.tf b/deploy/tf/ecs/variables.tf index abf45f6..7645e9d 100644 --- a/deploy/tf/ecs/variables.tf +++ b/deploy/tf/ecs/variables.tf @@ -13,6 +13,11 @@ variable "alb_zone_id" { type = string } +variable "app_name" { + description = "The name of the application e.g. sample-django-app" + type = string +} + variable "app_hostnames" { description = "Hostnames to associate with the application" type = list(string) diff --git a/deploy/tg/ecs/terragrunt.hcl b/deploy/tg/ecs/terragrunt.hcl index d4c09d0..5bf8f99 100644 --- a/deploy/tg/ecs/terragrunt.hcl +++ b/deploy/tg/ecs/terragrunt.hcl @@ -17,6 +17,7 @@ include "global" { } inputs = { + app_name = get_env("APP_NAME") environment = local.global.environment # DNS hostnames to associate with the container