Skip to content

Commit cb2a964

Browse files
authored
feat: alb output and other config (#5)
2 parents 7afd3ad + ec5ff84 commit cb2a964

File tree

5 files changed

+110
-3
lines changed

5 files changed

+110
-3
lines changed

datasources.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# AWS Academy Vocareum AWS Learner Lab
1+
# AWS Academy Vocareum AWS Learner Lab
22
data "aws_iam_role" "lab_role" {
33
name = "LabRole"
44
}

lb.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ resource "aws_lb_listener" "main" {
2424
fixed_response {
2525
content_type = "text/plain"
2626
status_code = "418"
27-
message_body = "SOAT Tech Challenge - Invalid destination"
27+
message_body = "SOAT Tech Challenge - ALB Invalid destination"
2828
}
2929
}
3030

lb_outputs.tf

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
output "lb_lb" {
2+
description = "ALB"
3+
value = {
4+
"arn" : aws_lb.main.arn
5+
"arn_suffix" : aws_lb.main.arn_suffix
6+
"dns_name" : aws_lb.main.dns_name
7+
"id" : aws_lb.main.id
8+
"internal" : aws_lb.main.internal
9+
"ip_address_type" : aws_lb.main.ip_address_type
10+
"load_balancer_type" : aws_lb.main.load_balancer_type
11+
"name" : aws_lb.main.name
12+
"security_groups" : aws_lb.main.security_groups
13+
"subnet_mapping" : aws_lb.main.subnet_mapping
14+
"subnets" : aws_lb.main.subnets
15+
"tags" : aws_lb.main.tags
16+
"vpc_id" : aws_lb.main.vpc_id
17+
"zone_id" : aws_lb.main.zone_id
18+
}
19+
}
20+
21+
output "lb_tgs" {
22+
description = "ALB Target Groups"
23+
value = {
24+
"ecs_identification_svc_tg" : {
25+
"arn" : aws_lb_target_group.ecs_identification_svc_tg.arn
26+
"arn_suffix" : aws_lb_target_group.ecs_identification_svc_tg.arn_suffix
27+
"health_check" : aws_lb_target_group.ecs_identification_svc_tg.health_check
28+
"id" : aws_lb_target_group.ecs_identification_svc_tg.id
29+
"ip_address_type" : aws_lb_target_group.ecs_identification_svc_tg.ip_address_type
30+
"name" : aws_lb_target_group.ecs_identification_svc_tg.name
31+
"name_prefix" : aws_lb_target_group.ecs_identification_svc_tg.name_prefix
32+
"port" : aws_lb_target_group.ecs_identification_svc_tg.port
33+
"protocol_version" : aws_lb_target_group.ecs_identification_svc_tg.protocol_version
34+
"tags" : aws_lb_target_group.ecs_identification_svc_tg.tags
35+
"target_type" : aws_lb_target_group.ecs_identification_svc_tg.target_type
36+
"vpc_id" : aws_lb_target_group.ecs_identification_svc_tg.vpc_id
37+
}
38+
"ecs_order_svc_tg" : {
39+
"arn" : aws_lb_target_group.ecs_order_svc_tg.arn
40+
"arn_suffix" : aws_lb_target_group.ecs_order_svc_tg.arn_suffix
41+
"health_check" : aws_lb_target_group.ecs_order_svc_tg.health_check
42+
"id" : aws_lb_target_group.ecs_order_svc_tg.id
43+
"ip_address_type" : aws_lb_target_group.ecs_order_svc_tg.ip_address_type
44+
"name" : aws_lb_target_group.ecs_order_svc_tg.name
45+
"name_prefix" : aws_lb_target_group.ecs_order_svc_tg.name_prefix
46+
"port" : aws_lb_target_group.ecs_order_svc_tg.port
47+
"protocol_version" : aws_lb_target_group.ecs_order_svc_tg.protocol_version
48+
"tags" : aws_lb_target_group.ecs_order_svc_tg.tags
49+
"target_type" : aws_lb_target_group.ecs_order_svc_tg.target_type
50+
"vpc_id" : aws_lb_target_group.ecs_order_svc_tg.vpc_id
51+
}
52+
"ecs_payment_svc_tg" : {
53+
"arn" : aws_lb_target_group.ecs_payment_svc_tg.arn
54+
"arn_suffix" : aws_lb_target_group.ecs_payment_svc_tg.arn_suffix
55+
"health_check" : aws_lb_target_group.ecs_payment_svc_tg.health_check
56+
"id" : aws_lb_target_group.ecs_payment_svc_tg.id
57+
"ip_address_type" : aws_lb_target_group.ecs_payment_svc_tg.ip_address_type
58+
"name" : aws_lb_target_group.ecs_payment_svc_tg.name
59+
"name_prefix" : aws_lb_target_group.ecs_payment_svc_tg.name_prefix
60+
"port" : aws_lb_target_group.ecs_payment_svc_tg.port
61+
"protocol_version" : aws_lb_target_group.ecs_payment_svc_tg.protocol_version
62+
"tags" : aws_lb_target_group.ecs_payment_svc_tg.tags
63+
"target_type" : aws_lb_target_group.ecs_payment_svc_tg.target_type
64+
"vpc_id" : aws_lb_target_group.ecs_payment_svc_tg.vpc_id
65+
}
66+
"ecs_production_svc_tg" : {
67+
"arn" : aws_lb_target_group.ecs_production_svc_tg.arn
68+
"arn_suffix" : aws_lb_target_group.ecs_production_svc_tg.arn_suffix
69+
"health_check" : aws_lb_target_group.ecs_production_svc_tg.health_check
70+
"id" : aws_lb_target_group.ecs_production_svc_tg.id
71+
"ip_address_type" : aws_lb_target_group.ecs_production_svc_tg.ip_address_type
72+
"name" : aws_lb_target_group.ecs_production_svc_tg.name
73+
"name_prefix" : aws_lb_target_group.ecs_production_svc_tg.name_prefix
74+
"port" : aws_lb_target_group.ecs_production_svc_tg.port
75+
"protocol_version" : aws_lb_target_group.ecs_production_svc_tg.protocol_version
76+
"tags" : aws_lb_target_group.ecs_production_svc_tg.tags
77+
"target_type" : aws_lb_target_group.ecs_production_svc_tg.target_type
78+
"vpc_id" : aws_lb_target_group.ecs_production_svc_tg.vpc_id
79+
}
80+
}
81+
}
82+

lb_target_groups.tf

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ resource "aws_lb_target_group" "ecs_identification_svc_tg" {
88
target_type = "ip"
99
vpc_id = aws_vpc.main.id
1010

11+
health_check {
12+
interval = 10
13+
path = "/identification/actuator/health"
14+
}
15+
1116
tags = {
1217
Name : "SOAT-TC ALB Identification Service Target Group"
1318
}
@@ -20,6 +25,11 @@ resource "aws_lb_target_group" "ecs_order_svc_tg" {
2025
target_type = "ip"
2126
vpc_id = aws_vpc.main.id
2227

28+
health_check {
29+
interval = 10
30+
path = "/order/actuator/health"
31+
}
32+
2333
tags = {
2434
Name : "SOAT-TC ALB Order Service Target Group"
2535
}
@@ -32,6 +42,12 @@ resource "aws_lb_target_group" "ecs_payment_svc_tg" {
3242
target_type = "ip"
3343
vpc_id = aws_vpc.main.id
3444

45+
health_check {
46+
interval = 10
47+
path = "/payment/actuator/health"
48+
}
49+
50+
3551
tags = {
3652
Name : "SOAT-TC ALB Payment Service Target Group"
3753
}
@@ -45,6 +61,12 @@ resource "aws_lb_target_group" "ecs_production_svc_tg" {
4561
target_type = "ip"
4662
vpc_id = aws_vpc.main.id
4763

64+
health_check {
65+
interval = 10
66+
path = "/production/actuator/health"
67+
}
68+
69+
4870
tags = {
4971
Name : "SOAT-TC ALB Production Service Target Group"
5072
}

variables.tf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,17 @@ variable "aws_region" {
99
variable "aws_access_key" {
1010
description = "AWS Access Key"
1111
type = string
12+
sensitive = true
1213
}
1314

1415
variable "aws_secret_key" {
1516
description = "AWS Secret Key"
1617
type = string
18+
sensitive = true
1719
}
1820

1921
variable "aws_session_token" {
20-
description = "AWS Secret Key"
22+
description = "AWS Session Token"
2123
type = string
24+
sensitive = true
2225
}

0 commit comments

Comments
 (0)