diff --git a/services/terraform/remote/service_landing.tf b/services/terraform/remote/service_landing.tf new file mode 100644 --- /dev/null +++ b/services/terraform/remote/service_landing.tf @@ -0,0 +1,38 @@ +locals { + landing_container_name = "landing" + + landing_run_server_config = jsonencode({ + runKeyserver = false + runWebApp = false + runLanding = true + }) + + landing_environment_vars = merge( + local.webapp_landing_environment_vars_encoded, + local.stage_specific_environment_vars_encoded, + local.shared_keyserver_environment_vars, + { + "COMM_NODE_ROLE" = "landing", + "COMM_JSONCONFIG_facts_run_server_config" = local.landing_run_server_config + }) +} + +module "landing_service" { + source = "../modules/keyserver_node_service" + + container_name = "landing" + image = local.keyserver_image + service_name = "landing" + cluster_id = aws_ecs_cluster.comm_services.id + domain_name = local.is_staging ? "comm.engineer" : "comm.app" + vpc_id = aws_vpc.default.id + vpc_subnets = [aws_subnet.public_a.id, aws_subnet.public_b.id] + region = "us-east-2" + environment_vars = local.landing_environment_vars + ecs_task_role_arn = aws_iam_role.keyserver_node_ecs_task_role.arn + ecs_task_execution_role_arn = aws_iam_role.ecs_task_execution.arn +} + +output "landing_service_load_balancer_dns_name" { + value = module.landing_service.service_load_balancer_dns_name +} diff --git a/services/terraform/remote/service_webapp.tf b/services/terraform/remote/service_webapp.tf --- a/services/terraform/remote/service_webapp.tf +++ b/services/terraform/remote/service_webapp.tf @@ -1,6 +1,4 @@ locals { - webapp_image_tag = "1.0.103" - webapp_service_image = "commapp/keyserver:${local.webapp_image_tag}" webapp_container_name = "webapp" webapp_run_server_config = jsonencode({ @@ -9,25 +7,11 @@ runLanding = false }) - webapp_landing_environment_vars = local.secrets["webappLandingEnvVars"] - - webapp_landing_environment_vars_encoded = { - for key, value in local.webapp_landing_environment_vars : key => jsonencode(value) - } - - stage_specific_environment_vars = (local.is_staging ? - local.secrets["webappLandingStagingEnvVars"] : - local.secrets["webappLandingProdEnvVars"]) - - stage_specific_environment_vars_encoded = { - for key, value in local.stage_specific_environment_vars : key => jsonencode(value) - } - webapp_environment_vars = merge( local.webapp_landing_environment_vars_encoded, local.stage_specific_environment_vars_encoded, + local.shared_keyserver_environment_vars, { - "COMM_LISTEN_ADDR" = "0.0.0.0", "COMM_NODE_ROLE" = "webapp", "COMM_JSONCONFIG_facts_run_server_config" = local.webapp_run_server_config }) @@ -37,7 +21,7 @@ source = "../modules/keyserver_node_service" container_name = "webapp" - image = local.webapp_service_image + image = local.keyserver_image service_name = "webapp" cluster_id = aws_ecs_cluster.comm_services.id domain_name = local.is_staging ? "comm.software" : "web.comm.app" diff --git a/services/terraform/remote/shared_webapp_landing.tf b/services/terraform/remote/shared_webapp_landing.tf new file mode 100644 --- /dev/null +++ b/services/terraform/remote/shared_webapp_landing.tf @@ -0,0 +1,22 @@ +locals { + keyserver_image_tag = "1.0.103" + keyserver_image = "commapp/keyserver:${local.keyserver_image_tag}" + + shared_keyserver_environment_vars = { + "COMM_LISTEN_ADDR" = "0.0.0.0", + } + + webapp_landing_environment_vars = local.secrets["webappLandingEnvVars"] + + webapp_landing_environment_vars_encoded = { + for key, value in local.webapp_landing_environment_vars : key => jsonencode(value) + } + + stage_specific_environment_vars = (local.is_staging ? + local.secrets["webappLandingStagingEnvVars"] : + local.secrets["webappLandingProdEnvVars"]) + + stage_specific_environment_vars_encoded = { + for key, value in local.stage_specific_environment_vars : key => jsonencode(value) + } +}