Cert with load balancer listener

This commit is contained in:
shockrah 2023-01-02 18:36:48 -08:00
parent 97205a216c
commit f96f6569cf
2 changed files with 17 additions and 3 deletions

11
infra/cert.tf Normal file
View File

@ -0,0 +1,11 @@
# Here is the TLS cert that we create for the alpha cluster
resource "aws_acm_certificate" "sample" {
domain_name = "sample.project-athens.xyz"
validation_method = "DNS"
}
resource "aws_acm_certificate_validation" "sample" {
certificate_arn = aws_acm_certificate.sample.arn
validation_record_fqdns = [ aws_route53_record.project-athens-record["2"].fqdn ]
}

View File

@ -25,10 +25,13 @@ resource "aws_lb_target_group" "alpha_cluster" {
vpc_id = aws_vpc.athens_vpc.id vpc_id = aws_vpc.athens_vpc.id
} }
resource "aws_lb_listener" "http" { resource "aws_lb_listener" "https" {
load_balancer_arn = aws_lb.alpha.arn load_balancer_arn = aws_lb.alpha.arn
port = 80 port = 443
protocol = "HTTP" protocol = "HTTPS"
ssl_policy = "ELBSecurityPolicy-2016-08"
certificate_arn = aws_acm_certificate_validation.sample.certificate_arn
default_action { default_action {
type = "forward" type = "forward"
target_group_arn = aws_lb_target_group.alpha_cluster.arn target_group_arn = aws_lb_target_group.alpha_cluster.arn