security_groups.tf 682 B

123456789101112131415161718192021222324252627282930313233
  1. resource "aws_security_group" "allow_access" {
  2. name_prefix = local.unique_id
  3. description = "Allow inbound traffic"
  4. vpc_id = aws_vpc.main.id
  5. ingress {
  6. description = "Allow all inbound."
  7. from_port = 0
  8. to_port = 0
  9. protocol = "-1"
  10. cidr_blocks = [aws_vpc.main.cidr_block]
  11. }
  12. egress {
  13. description = "Allow all outbound."
  14. from_port = 0
  15. to_port = 0
  16. protocol = "-1"
  17. # tfsec:ignore:aws-ec2-no-public-egress-sgr For the lab, all outbound is fine.
  18. cidr_blocks = ["0.0.0.0/0"]
  19. }
  20. depends_on = [aws_subnet.main]
  21. lifecycle {
  22. ignore_changes = [
  23. ingress,
  24. egress,
  25. ]
  26. }
  27. tags = local.tags
  28. }