There is a repeatable configuration that I see in many Terraform projects where the provider is AWS: The configuration of an outbound (egress) rule to allow ALL outbound traffic.
As far as I understand, this is the default behavior in AWS as mentioned in the AWS user guide:
By default, a security group includes an outbound rule that allows all outbound traffic. You can remove the rule and add outbound rules that allow specific outbound traffic only. If your security group has no outbound rules, no outbound traffic originating from your instance is allowed.
An example for a common Terraform setup for security group - The focus of my question is the egress block:
resource "aws_security_group" "my_sg" {
name = "my_sg"
description = "Some description"
vpc_id = "${aws_vpc.my_vpc.id}"
tags {
Name = "my_sg_tag"
}
#Not redundant - Because a new security group has no inbound rules.
ingress {
from_port = "80"
to_port = "80"
protocol = "TCP"
cidr_blocks = ["0.0.0.0/0"]
}
#Isn't this redundant?
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
}
Is this configuration being made for documentation or does it have a technical reason?