Skip to content

Commit

Permalink
updated the security group
Browse files Browse the repository at this point in the history
  • Loading branch information
prashansa joshi committed Sep 25, 2024
1 parent fc2e29c commit db84ea5
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 11 deletions.
2 changes: 1 addition & 1 deletion terraform/alb.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module "alb" {
health_check = {
enabled = true
path = "/"
protocol = "HTTP" # Customize this based on your needs
protocol = "HTTP" # Customize this based on your needs
matcher = "200-299" # HTTP status codes that indicate a healthy response
interval = 30 # Time in seconds between health checks
timeout = 15 # Time in seconds to wait for a response before marking as failed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 3.74"
version = ">= 5.0"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.24"
version = ">= 5.0"
}
}
}
12 changes: 6 additions & 6 deletions terraform/prod.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ additional_settings = [
]

env_vars = {
"DB_HOST" = "ebs-ue1-eb-d-rds.cmuokqciitb8.us-east-1.rds.amazonaws.com"
"DB_PORT" = "3306"
"DB_USERNAME" = "elasticbeanstalk"
"DB_PASSWORD" = "AlXmBgEuzUl3h3qA"
"DB_NAME" = "elasticbeanstalk"
}
"DB_HOST" = "ebs-ue1-eb-d-rds.cmuokqciitb8.us-east-1.rds.amazonaws.com"
"DB_PORT" = "3306"
"DB_USERNAME" = "elasticbeanstalk"
"DB_PASSWORD" = "AlXmBgEuzUl3h3qA"
"DB_NAME" = "elasticbeanstalk"
}

scheduled_actions = [
{
Expand Down
2 changes: 1 addition & 1 deletion terraform/s3.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ module "s3_bucket" {

tags = module.naming.resources.s3.tags

}
}
2 changes: 1 addition & 1 deletion terraform/secrets_manager.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ module "secrets_manager" {
password = module.rds.db_instance_password
})

# tags = module.naming.resources.secrets_manager.tags
# tags = module.naming.resources.secrets_manager.tags

}
14 changes: 14 additions & 0 deletions terraform/sg.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ resource "aws_security_group" "alb" {
cidr_blocks = ["0.0.0.0/0"]
}

# egress {
# from_port = 8080
# to_port = 8080
# protocol = "tcp"
# security_groups = [aws_security_group.eb_instances.id] # Allow traffic to EB instances on port 8080
# }

# Outbound rule to allow all traffic
egress {
from_port = 0
Expand Down Expand Up @@ -92,6 +99,13 @@ resource "aws_security_group" "eb_instances" {
security_groups = [aws_security_group.alb.id]
}

ingress {
from_port = 8080
to_port = 8080
protocol = "tcp"
security_groups = [aws_security_group.alb.id] # Allow traffic from ALB only
}

egress {
from_port = 0
to_port = 0
Expand Down

0 comments on commit db84ea5

Please sign in to comment.