Skip to content

Commit 90c8c67

Browse files
committed
Add explanatory comments
1 parent bc8afa9 commit 90c8c67

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

terraform/modules/dns/main.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ resource "aws_route53_record" "backend" {
2222
}
2323
}
2424

25+
# Request an SSL certificate for the frontend domain using AWS Certificate Manager (ACM)
2526
resource "aws_acm_certificate" "frontend_cert" {
2627
domain_name = var.frontend_record_name
2728
validation_method = "DNS"
@@ -32,7 +33,9 @@ resource "aws_acm_certificate" "frontend_cert" {
3233
}
3334
}
3435

36+
# Create DNS validation records for the SSL certificate
3537
resource "aws_route53_record" "frontend_cert_validation" {
38+
# Iterate over the domain validation options for the ACM certificate for the frontend domain. The result is then accessible via the `each` object.
3639
for_each = {
3740
for dvo in aws_acm_certificate.frontend_cert.domain_validation_options : dvo.domain_name => {
3841
name = dvo.resource_record_name
@@ -52,6 +55,8 @@ resource "aws_route53_record" "frontend_cert_validation" {
5255
}
5356
}
5457

58+
# Validate the SSL certificate using the DNS records created above
59+
# fqdn: Fully Qualified Domain Name, i.e., dev.interviewprep.onyxdevtutorials.com
5560
resource "aws_acm_certificate_validation" "frontend_cert_validation" {
5661
certificate_arn = aws_acm_certificate.frontend_cert.arn
5762
validation_record_fqdns = [for record in aws_route53_record.frontend_cert_validation : record.fqdn]

terraform/modules/load_balancer/main.tf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Create an Application Load Balancer (ALB) to route incoming traffic to the frontend and backend services.
12
resource "aws_lb" "this" {
23
name = "${var.environment}-interview-prep-lb"
34
internal = false # Set to false to create an internet-facing load balancer
@@ -63,8 +64,9 @@ resource "aws_lb_listener" "https_frontend" {
6364
load_balancer_arn = aws_lb.this.arn
6465
port = 443
6566
protocol = "HTTPS"
67+
# ELBSecurityPolicy-2016-08 is a security policy that includes a set of SSL/TLS protocols and ciphers that are considered secure as of August 2016. It is designed to provide a balance between compatibility with older clients and security.
6668
ssl_policy = "ELBSecurityPolicy-2016-08"
67-
certificate_arn = var.frontend_cert_arn
69+
certificate_arn = var.frontend_cert_arn # Refer to the DNS module to see how the certificate ARN is passed to the load balancer.
6870

6971
default_action {
7072
type = "forward"

0 commit comments

Comments
 (0)