Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion answerking/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
CORS_REPLACE_HTTPS_REFERER = False

SECURE_PROXY_SSL_HEADER = None
SECURE_SSL_REDIRECT = False
SECURE_SSL_REDIRECT = True
SESSION_COOKIE_SECURE = False
CSRF_COOKIE_SECURE = False

Expand Down
1 change: 1 addition & 0 deletions answerking/settings/development.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@
"VERSION": "1.0.0",
"SERVE_INCLUDE_SCHEMA": False,
}
SECURE_SSL_REDIRECT = False
33 changes: 29 additions & 4 deletions terraform/ecs_fargate/lb.tf
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,44 @@ resource "aws_lb_target_group" "eip_target" {
}
}

resource "aws_lb_listener" "eip_listener" {

resource "aws_acm_certificate" "cert" {
domain_name = var.dns_record_name
validation_method = "DNS"

lifecycle {
create_before_destroy = true
}
}

resource "aws_lb_listener" "eip_listener_http_301" {
load_balancer_arn = aws_lb.eip_lb.arn
port = var.host_port
protocol = var.lb_protocol
port = "80"
protocol = "TCP"

default_action {
type = "forward"
target_group_arn = aws_lb_target_group.eip_target.id
}


}

resource "aws_lb_listener" "eip_listener" {
load_balancer_arn = aws_lb.eip_lb.arn
port = "443"
protocol = "TLS"
certificate_arn = aws_acm_certificate.cert.arn

default_action {
type = "forward"
target_group_arn = aws_lb_target_group.eip_target.arn
target_group_arn = aws_lb_target_group.eip_target.id
}

tags = {
Name = "${var.project_name}-lb-listener"
Owner = var.owner
}
}


2 changes: 2 additions & 0 deletions terraform/ecs_fargate/route53.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

resource "aws_route53_record" "python" {
zone_id = var.dns_hosted_zone_id
name = var.dns_record_name
Expand All @@ -10,3 +11,4 @@ resource "aws_route53_record" "python" {
country = "GB"
}
}

16 changes: 1 addition & 15 deletions terraform/ecs_fargate/sg.tf
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
resource "aws_security_group" "ecs_sg" {
vpc_id = module.vpc_subnet_setup.vpc_id

ingress {
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}

ingress {
from_port = 443
to_port = 443
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}

ingress {
from_port = 8000
to_port = 8000
Expand Down Expand Up @@ -57,4 +43,4 @@ resource "aws_security_group" "rds_sg" {
Name = "${var.project_name}-rds-sg"
Owner = var.owner
}
}
}