Skip to content

Commit

Permalink
Merge pull request #17 from aodn/fix_alb_target_group
Browse files Browse the repository at this point in the history
tg/tf: generalise the application name
  • Loading branch information
digorgonzola authored Dec 9, 2023
2 parents 941880a + f16de6a commit 2f8b366
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion deploy/tf/ecs/alb.tf
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
4 changes: 2 additions & 2 deletions deploy/tf/ecs/ecs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down
5 changes: 5 additions & 0 deletions deploy/tf/ecs/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions deploy/tg/ecs/terragrunt.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ include "global" {
}

inputs = {
app_name = get_env("APP_NAME")
environment = local.global.environment

# DNS hostnames to associate with the container
Expand Down

0 comments on commit 2f8b366

Please sign in to comment.