Terraform - referencing existing security group
You can retrieve security group from data source

variable "security_group_id" {}

data "aws_security_group" "selected" {
  id = "${var.security_group_id}"
}