Created
September 20, 2023 07:38
-
-
Save estenssoros/4b37adeae178358038b9ff4bb74e7e6d to your computer and use it in GitHub Desktop.
Docker, ECR, Elastic Beanstalk, & Terraform security_groups.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data "http" "myip" { | |
url = "http://ipv4.icanhazip.com" | |
} | |
resource "aws_security_group" "ebs" { | |
name = "${local.common_name}-ebs" | |
vpc_id = var.vpc_id | |
# for ssh | |
ingress { | |
from_port = 22 | |
to_port = 22 | |
self = true | |
protocol = "tcp" | |
cidr_blocks = [ | |
"${chomp(data.http.myip.response_body)}/32" | |
] | |
} | |
# to fetch stuff | |
egress { | |
from_port = 80 | |
to_port = 80 | |
self = true | |
protocol = "tcp" | |
cidr_blocks = [ | |
"0.0.0.0/0" | |
] | |
} | |
egress { | |
from_port = 443 | |
to_port = 443 | |
self = true | |
protocol = "tcp" | |
cidr_blocks = [ | |
"0.0.0.0/0" | |
] | |
} | |
# for database | |
egress { | |
from_port = 5432 | |
to_port = 5432 | |
self = true | |
protocol = "tcp" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment