Skip to content

Commit ed793ba

Browse files
committed
Fix outputs
1 parent 078ac0a commit ed793ba

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

operations/deployment/terraform/aws/bitovi_main.tf

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ module "aws_lb" {
155155
aws_alb_target_sg_id = module.ec2[0].aws_security_group_ec2_sg_id
156156
aws_r53_domain_name = var.aws_r53_domain_name
157157
# Certs
158-
#aws_certificates_selected_arn = var.aws_r53_enable_cert && var.aws_r53_domain_name != "" ? module.aws_certificates[0].selected_arn : ""
159158
aws_certificate_enabled = var.aws_r53_enable_cert && length(module.aws_certificates) > 0 ? true : false
160159
aws_certificates_selected_arn = try(module.aws_certificates[0].selected_arn, "")
161160
# Others
@@ -787,11 +786,13 @@ locals {
787786
) :
788787
false
789788
)
789+
protocol = var.aws_r53_enable_cert ? module.aws_certificates[0].selected_arn != "" ? "https://" : "http://" : "http://"
790790
create_efs = var.aws_efs_create == true ? true : (var.aws_efs_create_ha == true ? true : false)
791791
ec2_public_endpoint = var.aws_ec2_instance_create ? (module.ec2[0].instance_public_dns != null ? module.ec2[0].instance_public_dns : module.ec2[0].instance_public_ip) : null
792792
ec2_private_endpoint = var.aws_ec2_instance_create ? (module.ec2[0].instance_private_dns != null ? module.ec2[0].instance_private_dns : module.ec2[0].instance_private_ip) : null
793-
ec2_endpoint = var.aws_ec2_instance_create ? (local.ec2_public_endpoint != null ? "http://${local.ec2_public_endpoint}" : "http://${local.ec2_private_endpoint}") : null
794-
elb_url = try(module.aws_elb[0].aws_elb_dns_name, null) != null ? "http://${module.aws_elb[0].aws_elb_dns_name}" : null
793+
ec2_endpoint = var.aws_ec2_instance_create ? (local.ec2_public_endpoint != null ? "${local.protocol}${local.ec2_public_endpoint}" : "${local.protocol}${local.ec2_private_endpoint}") : null
794+
elb_url = try(module.aws_elb[0].aws_elb_dns_name, null) != null ? "${local.protocol}${module.aws_elb[0].aws_elb_dns_name}" : null
795+
alb_url = try(module.aws_alb[0].aws_alb_dns_name, null) != null ? "${local.protocol}${module.aws_alb[0].aws_alb_dns_name}" : null
795796
}
796797

797798
# VPC
@@ -839,13 +840,18 @@ output "aws_elb_dns_name" {
839840
value = try(module.aws_elb[0].aws_elb_dns_name, null)
840841
}
841842

843+
output "aws_alb_dns_name" {
844+
description = "Public DNS address of the ALB"
845+
value = try(module.aws_alb[0].aws_alb_dns_name, null)
846+
}
847+
842848
output "application_public_dns" {
843849
description = "Public DNS address for the application or load balancer public DNS"
844850
value = try(module.aws_route53[0].vm_url, null)
845851
}
846852

847853
output "vm_url" {
848-
value = try(module.aws_route53[0].vm_url, local.elb_url)
854+
value = try(module.aws_route53[0].vm_url, local.alb_url, local.elb_url)
849855
}
850856

851857
# EFS

0 commit comments

Comments
 (0)