@@ -602,8 +602,6 @@ resource "aws_security_group_rule" "lbsh_from_networks_https" {
602602resource "aws_alb_target_group" "shc-users" {
603603 name_prefix = " shcu-"
604604 port = 8000
605- protocol = " HTTP"
606- # protocol = var.sh_protocol
607605 vpc_id = local. master_vpc_id
608606 load_balancing_algorithm_type = " round_robin"
609607 # important : use round robin here, sessions will spread over time better than with a theorical clever algo
@@ -658,8 +656,9 @@ resource "aws_lb" "shc-users" {
658656
659657resource "aws_alb_listener" "shc-users" {
660658 load_balancer_arn = aws_lb. shc-users . arn
659+ protocol = " HTTPS"
660+ certificate_arn = aws_acm_certificate_validation. acm_certificate_validation_elb_shcusers . certificate_arn
661661 port = 8000
662- protocol = " HTTP"
663662 # port = 443
664663 # protocol = "HTTPS"
665664 default_action {
@@ -668,6 +667,35 @@ resource "aws_alb_listener" "shc-users" {
668667 }
669668}
670669
670+ resource "aws_acm_certificate" "acm_certificate_elb_shcusers" {
671+ domain_name = var. dns-zone-name
672+ validation_method = " DNS"
673+ lifecycle {
674+ create_before_destroy = true
675+ }
676+ }
677+
678+ resource "aws_route53_record" "validation_route53_record_elb_shcusers" {
679+ for_each = {
680+ for dvo in aws_acm_certificate . acm_certificate_elb_shcusers . domain_validation_options : dvo . domain_name => {
681+ name = dvo.resource_record_name
682+ record = dvo.resource_record_value
683+ type = dvo.resource_record_type
684+ }
685+ }
686+ allow_overwrite = true
687+ name = each. value . name
688+ records = [each . value . record ]
689+ ttl = 60
690+ type = each. value . type
691+ zone_id = module. network . dnszone_id
692+ }
693+
694+ resource "aws_acm_certificate_validation" "acm_certificate_validation_elb_shcusers" {
695+ certificate_arn = aws_acm_certificate. acm_certificate_elb_shcusers . arn
696+ validation_record_fqdns = [for record in aws_route53_record . validation_route53_record_elb_shcusers : record . fqdn ]
697+ }
698+
671699# resource "aws_route53_record" "shc-users" {
672700# zone_id = aws_route53_zone.dnszone.zone_id
673701# name = "shc"
0 commit comments