jenkins-gitops-deploy-ec2 / terraform-dir / security-group.tf
security-group.tf
Raw
resource "aws_security_group" "project_sg" {
    name = "project_sg"
    vpc_id = aws_vpc.project_vpc.id
    ingress {
        from_port = 22
        to_port = 22
        protocol = "tcp"
        #cidr_blocks = ["0.0.0.0/0"]
        cidr_blocks = [var.my_ip, var.jenkins_ip]
    }
    ingress {
        from_port = 5555
        to_port = 5555
        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"]
        prefix_list_ids = []
    }
    tags = {
        Name: "${var.env}-sg"
    }
}