Skip to content

Commit

Permalink
[ISSUE 597] Fix health check for frontend container (#599)
Browse files Browse the repository at this point in the history
  • Loading branch information
daphnegold authored Oct 17, 2023
1 parent 608635e commit ecda7ad
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions infra/frontend/app-config/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ locals {
has_database = false
has_incident_management_service = false
enable_autoscaling = true
hostname = "0.0.0.0"

build_repository_config = {
region = module.project_config.default_region
Expand Down
4 changes: 4 additions & 0 deletions infra/frontend/app-config/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,7 @@ output "environment_configs" {
output "enable_autoscaling" {
value = local.enable_autoscaling
}

output "hostname" {
value = local.hostname
}
1 change: 1 addition & 0 deletions infra/frontend/service/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ module "service" {
subnet_ids = data.aws_subnets.default.ids
enable_autoscaling = module.app_config.enable_autoscaling
cert_arn = terraform.workspace == "default" ? data.aws_acm_certificate.cert[0].arn : null
hostname = module.app_config.hostname

db_vars = module.app_config.has_database ? {
security_group_ids = data.aws_rds_cluster.db_cluster[0].vpc_security_group_ids
Expand Down
5 changes: 3 additions & 2 deletions infra/modules/service/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ locals {
log_stream_prefix = var.service_name
task_executor_role_name = "${var.service_name}-task-executor"
image_url = "${data.aws_ecr_repository.app.repository_url}:${var.image_tag}"
hostname = var.hostname != null ? [{ name = "HOSTNAME", value = var.hostname }] : []

base_environment_variables = [
base_environment_variables = concat([
{ name : "PORT", value : tostring(var.container_port) },
{ name : "AWS_REGION", value : data.aws_region.current.name },
]
], local.hostname)
db_environment_variables = var.db_vars == null ? [] : [
{ name : "DB_HOST", value : var.db_vars.connection_info.host },
{ name : "DB_PORT", value : var.db_vars.connection_info.port },
Expand Down
6 changes: 6 additions & 0 deletions infra/modules/service/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ variable "container_port" {
default = 8000
}

variable "hostname" {
type = string
description = "The hostname to override the default AWS configuration"
default = null
}

variable "vpc_id" {
type = string
description = "Uniquely identifies the VPC."
Expand Down

0 comments on commit ecda7ad

Please sign in to comment.