Skip to content
Merged
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
63 changes: 33 additions & 30 deletions templates/mini-runtime.tf
Original file line number Diff line number Diff line change
Expand Up @@ -151,22 +151,6 @@ resource "aws_iam_role_policy" "get_akto_lambda_policy" {
})
}

# Lambda Function
resource "aws_lambda_function" "get_akto_setup_details" {
function_name = "GetAktoSetupDetails"
runtime = "nodejs16.x"
role = aws_iam_role.lambda_execution_role.arn
handler = "index.handler"
timeout = 60
environment {
variables = {
TARGET_LB = aws_lb.akto_nlb.dns_name
}
}
s3_bucket = "akto-setup-${var.region}"
s3_key = "templates/get-akto-setup-details.zip"
}

# IAM Role for EC2 Instances
resource "aws_iam_instance_profile" "iam_instance_profile" {
name = "AktoInstanceProfile"
Expand Down Expand Up @@ -211,6 +195,26 @@ resource "aws_security_group" "akto_security_group" {
}
}

# Security Group
resource "aws_security_group" "lb_security_group" {
name_prefix = "lb-security-group"
vpc_id = data.aws_vpc.selected.id

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

egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
}

# Launch Configuration
resource "aws_launch_configuration" "akto_launch_configuration" {
name_prefix = "AktoASGLaunchConfiguration"
Expand Down Expand Up @@ -280,6 +284,7 @@ resource "aws_lb" "akto_nlb" {
load_balancer_type = "network"
ip_address_type = "ipv4"
subnets = [var.subnet_id]
security_groups = [aws_security_group.lb_security_group.id]

enable_cross_zone_load_balancing = true
}
Expand All @@ -293,13 +298,12 @@ resource "aws_lb_target_group" "akto_traffic_mirroring_target_group" {

health_check {
enabled = true
interval = 10
path = "/metrics"
port = "8000"
protocol = "HTTP"
timeout = 6
healthy_threshold = 2
unhealthy_threshold = 2
interval = 10 # Interval between health checks in seconds
port = "9092" # Change the health check port to 9092
protocol = "TCP" # Change the protocol to TCP
timeout = 6 # Timeout for health check response in seconds
healthy_threshold = 2 # Number of successful checks before marking healthy
unhealthy_threshold = 2 # Number of failed checks before marking unhealthy
}
}

Expand All @@ -311,13 +315,12 @@ resource "aws_lb_target_group" "akto_kafka_target_group" {

health_check {
enabled = true
interval = 10
path = "/metrics"
port = "8000"
protocol = "HTTP"
timeout = 6
healthy_threshold = 2
unhealthy_threshold = 2
interval = 10 # Interval between health checks in seconds
port = "9092" # Change the health check port to 9092
protocol = "TCP" # Change the protocol to TCP
timeout = 6 # Timeout for health check response in seconds
healthy_threshold = 2 # Number of successful checks before marking healthy
unhealthy_threshold = 2 # Number of failed checks before marking unhealthy
}
}

Expand Down