Setting the file. One moment.
Subchapter 33.30
References
Security Posture RulesScripts
Test Validate Terraform PolicyAlso bundled
Gitignorefixtures/terraform-policy/good-https-redirect/compute.tf
Terraform48 lines1008 B
resource "aws_lb" "app" {
name = "app-alb"
internal = false
load_balancer_type = "application"
}
resource "aws_lb_listener" "https" {
load_balancer_arn = aws_lb.app.arn
port = 443
protocol = "HTTPS"
ssl_policy = "ELBSecurityPolicy-TLS13-1-2-2021-06"
certificate_arn = var.acm_certificate_arn
default_action {
type = "forward"
target_group_arn = aws_lb_target_group.app.arn
}
}
resource "aws_lb_listener" "http_redirect" {
load_balancer_arn = aws_lb.app.arn
port = 80
protocol = "HTTP"
default_action {
type = "redirect"
redirect {
port = "443"
protocol = "HTTPS"
status_code = "HTTP_301"
}
}
}
resource "aws_lb_target_group" "app" {
name = "app-tg"
port = 8080
protocol = "HTTP"
vpc_id = aws_vpc.main.id
}
resource "aws_vpc" "main" {
cidr_block = "10.0.0.0/16"
}
variable "acm_certificate_arn" {
type = string
}