fpco / terraform-aws-foundation

Establish a solid Foundation on AWS with these modules for Terraform
MIT License
203 stars 99 forks source link

single-port-sg supports source_security_group_id #292

Open ketzacoatl opened 4 years ago

ketzacoatl commented 4 years ago

ATM, our ingress rules are like:

# ingress rule for tcp, if enabled
resource "aws_security_group_rule" "tcp_ingress" {
  count             = local.tcp
  type              = "ingress"
  description       = "${var.description} (tcp)"
  from_port         = var.port
  to_port           = var.port
  protocol          = "tcp"
  cidr_blocks       = var.cidr_blocks
  security_group_id = var.security_group_id
}

But it is sometimes nice to use source_security_group_id instead of cidr_blocks. The module should support both.