
Terraform modules to write once and reuse forever
Terraform modules to write once and reuse forever Module 1: Standard ALB resource "aws_lb" "main" { name = var . name ; load_balancer_type = "application" security_groups = [ aws_security_group . alb . id ] ; subnets = var . public_subnet_ids drop_invalid_header_fields = true ; enable_deletion_protection = true } resource "aws_lb_listener" "https" { load_balancer_arn = aws_lb . main . arn ; port = 443 ; protocol = "HTTPS" ssl_policy = "ELBSecurityPolicy-TLS13-1-2-2021-06" ; certificate_arn = var . certificate_arn default_action { type = "fixed-response" fixed_response { content_type = "text/plain" ; status_code = "404" } } } resource "aws_lb_listener" "redirect" { load_balancer_arn = aws_lb . main . arn ; port = 80 ; protocol = "HTTP" default_action { type = "redirect" redirect { port = "443" ; protocol = "HTTPS" ; status_code = "HTTP_301" } } } output "arn_suffix" { value = aws_lb . main . arn_suffix } output "https_listener" { value = aws_lb_listener . https . arn } Module 2: ECS IAM
Continue reading on Dev.to DevOps
Opens in a new tab



