Skip to content

Instantly share code, notes, and snippets.

@pradeepchhetri
Created October 1, 2015 13:56
Show Gist options
  • Select an option

  • Save pradeepchhetri/a0ccbac716d6ad4bd766 to your computer and use it in GitHub Desktop.

Select an option

Save pradeepchhetri/a0ccbac716d6ad4bd766 to your computer and use it in GitHub Desktop.
variable "allow_egress_all_ids" {
default = {
sg1 = "${aws_security_group.sg1.id}"
sg2 = "${aws_security_group.sg2.id}"
sg3 = "${aws_security_group.sg3.id}"
sg4 = "${aws_security_group.sg4.id}"
}
}
resource "aws_security_group_rule" "allow_egress_all" {
count = "${length(var.allow_egress_all_ids)}"
type = "egress"
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
security_group_id = "${lookup(var.allow_egress_all_ids, count.index)}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment