Skip to content

Commit

Permalink
feat: alb output and other config (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
g-otn committed Jan 29, 2024
2 parents 7afd3ad + ec5ff84 commit cb2a964
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 3 deletions.
2 changes: 1 addition & 1 deletion datasources.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# AWS Academy Vocareum AWS Learner Lab
# AWS Academy Vocareum AWS Learner Lab
data "aws_iam_role" "lab_role" {
name = "LabRole"
}
2 changes: 1 addition & 1 deletion lb.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ resource "aws_lb_listener" "main" {
fixed_response {
content_type = "text/plain"
status_code = "418"
message_body = "SOAT Tech Challenge - Invalid destination"
message_body = "SOAT Tech Challenge - ALB Invalid destination"
}
}

Expand Down
82 changes: 82 additions & 0 deletions lb_outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
output "lb_lb" {
description = "ALB"
value = {
"arn" : aws_lb.main.arn
"arn_suffix" : aws_lb.main.arn_suffix
"dns_name" : aws_lb.main.dns_name
"id" : aws_lb.main.id
"internal" : aws_lb.main.internal
"ip_address_type" : aws_lb.main.ip_address_type
"load_balancer_type" : aws_lb.main.load_balancer_type
"name" : aws_lb.main.name
"security_groups" : aws_lb.main.security_groups
"subnet_mapping" : aws_lb.main.subnet_mapping
"subnets" : aws_lb.main.subnets
"tags" : aws_lb.main.tags
"vpc_id" : aws_lb.main.vpc_id
"zone_id" : aws_lb.main.zone_id
}
}

output "lb_tgs" {
description = "ALB Target Groups"
value = {
"ecs_identification_svc_tg" : {
"arn" : aws_lb_target_group.ecs_identification_svc_tg.arn
"arn_suffix" : aws_lb_target_group.ecs_identification_svc_tg.arn_suffix
"health_check" : aws_lb_target_group.ecs_identification_svc_tg.health_check
"id" : aws_lb_target_group.ecs_identification_svc_tg.id
"ip_address_type" : aws_lb_target_group.ecs_identification_svc_tg.ip_address_type
"name" : aws_lb_target_group.ecs_identification_svc_tg.name
"name_prefix" : aws_lb_target_group.ecs_identification_svc_tg.name_prefix
"port" : aws_lb_target_group.ecs_identification_svc_tg.port
"protocol_version" : aws_lb_target_group.ecs_identification_svc_tg.protocol_version
"tags" : aws_lb_target_group.ecs_identification_svc_tg.tags
"target_type" : aws_lb_target_group.ecs_identification_svc_tg.target_type
"vpc_id" : aws_lb_target_group.ecs_identification_svc_tg.vpc_id
}
"ecs_order_svc_tg" : {
"arn" : aws_lb_target_group.ecs_order_svc_tg.arn
"arn_suffix" : aws_lb_target_group.ecs_order_svc_tg.arn_suffix
"health_check" : aws_lb_target_group.ecs_order_svc_tg.health_check
"id" : aws_lb_target_group.ecs_order_svc_tg.id
"ip_address_type" : aws_lb_target_group.ecs_order_svc_tg.ip_address_type
"name" : aws_lb_target_group.ecs_order_svc_tg.name
"name_prefix" : aws_lb_target_group.ecs_order_svc_tg.name_prefix
"port" : aws_lb_target_group.ecs_order_svc_tg.port
"protocol_version" : aws_lb_target_group.ecs_order_svc_tg.protocol_version
"tags" : aws_lb_target_group.ecs_order_svc_tg.tags
"target_type" : aws_lb_target_group.ecs_order_svc_tg.target_type
"vpc_id" : aws_lb_target_group.ecs_order_svc_tg.vpc_id
}
"ecs_payment_svc_tg" : {
"arn" : aws_lb_target_group.ecs_payment_svc_tg.arn
"arn_suffix" : aws_lb_target_group.ecs_payment_svc_tg.arn_suffix
"health_check" : aws_lb_target_group.ecs_payment_svc_tg.health_check
"id" : aws_lb_target_group.ecs_payment_svc_tg.id
"ip_address_type" : aws_lb_target_group.ecs_payment_svc_tg.ip_address_type
"name" : aws_lb_target_group.ecs_payment_svc_tg.name
"name_prefix" : aws_lb_target_group.ecs_payment_svc_tg.name_prefix
"port" : aws_lb_target_group.ecs_payment_svc_tg.port
"protocol_version" : aws_lb_target_group.ecs_payment_svc_tg.protocol_version
"tags" : aws_lb_target_group.ecs_payment_svc_tg.tags
"target_type" : aws_lb_target_group.ecs_payment_svc_tg.target_type
"vpc_id" : aws_lb_target_group.ecs_payment_svc_tg.vpc_id
}
"ecs_production_svc_tg" : {
"arn" : aws_lb_target_group.ecs_production_svc_tg.arn
"arn_suffix" : aws_lb_target_group.ecs_production_svc_tg.arn_suffix
"health_check" : aws_lb_target_group.ecs_production_svc_tg.health_check
"id" : aws_lb_target_group.ecs_production_svc_tg.id
"ip_address_type" : aws_lb_target_group.ecs_production_svc_tg.ip_address_type
"name" : aws_lb_target_group.ecs_production_svc_tg.name
"name_prefix" : aws_lb_target_group.ecs_production_svc_tg.name_prefix
"port" : aws_lb_target_group.ecs_production_svc_tg.port
"protocol_version" : aws_lb_target_group.ecs_production_svc_tg.protocol_version
"tags" : aws_lb_target_group.ecs_production_svc_tg.tags
"target_type" : aws_lb_target_group.ecs_production_svc_tg.target_type
"vpc_id" : aws_lb_target_group.ecs_production_svc_tg.vpc_id
}
}
}

22 changes: 22 additions & 0 deletions lb_target_groups.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ resource "aws_lb_target_group" "ecs_identification_svc_tg" {
target_type = "ip"
vpc_id = aws_vpc.main.id

health_check {
interval = 10
path = "/identification/actuator/health"
}

tags = {
Name : "SOAT-TC ALB Identification Service Target Group"
}
Expand All @@ -20,6 +25,11 @@ resource "aws_lb_target_group" "ecs_order_svc_tg" {
target_type = "ip"
vpc_id = aws_vpc.main.id

health_check {
interval = 10
path = "/order/actuator/health"
}

tags = {
Name : "SOAT-TC ALB Order Service Target Group"
}
Expand All @@ -32,6 +42,12 @@ resource "aws_lb_target_group" "ecs_payment_svc_tg" {
target_type = "ip"
vpc_id = aws_vpc.main.id

health_check {
interval = 10
path = "/payment/actuator/health"
}


tags = {
Name : "SOAT-TC ALB Payment Service Target Group"
}
Expand All @@ -45,6 +61,12 @@ resource "aws_lb_target_group" "ecs_production_svc_tg" {
target_type = "ip"
vpc_id = aws_vpc.main.id

health_check {
interval = 10
path = "/production/actuator/health"
}


tags = {
Name : "SOAT-TC ALB Production Service Target Group"
}
Expand Down
5 changes: 4 additions & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@ variable "aws_region" {
variable "aws_access_key" {
description = "AWS Access Key"
type = string
sensitive = true
}

variable "aws_secret_key" {
description = "AWS Secret Key"
type = string
sensitive = true
}

variable "aws_session_token" {
description = "AWS Secret Key"
description = "AWS Session Token"
type = string
sensitive = true
}

0 comments on commit cb2a964

Please sign in to comment.