module ssh_security {
  source = "../modules/aws/sg_ssh_only_restricted"
  security_group_name = "devops-tools-ssh"
  source_cidr_blocks  = var.vpc_cidr
  vpc_id              = module.network.vpc_id
}

module https_security {
  source = "../modules/aws/sg_https_only_latest"

  security_group_name = "devops-tools-https"
  vpc_id              = module.network.vpc_id
}

resource "aws_security_group" "nat-instance" {
    name        = "devops-nfn-gateway"
    description = "nfn-gateway"
    vpc_id      = module.network.vpc_id

    ingress {
        from_port   = 443
        to_port     = 443
        protocol    = "tcp"
        cidr_blocks = [var.vpc_cidr]
    }

    ingress {
        from_port   = 6300
        to_port     = 6320
        protocol    = "tcp"
        cidr_blocks = [var.vpc_cidr]
    }

    ingress {
        from_port   = 3306
        to_port     = 3306
        protocol    = "tcp"
        cidr_blocks = [var.vpc_cidr]
    }

    ingress {
        from_port   = 22
        to_port     = 22
        protocol    = "tcp"
        cidr_blocks = [var.vpc_cidr]
    }

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

    tags = {
            "Name" = "devops-nfn-gateway",
    }
}
