securitygroup-server.tf 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # SG Summary - Server
  2. # Legacy was:
  3. # TCP+UDP/1514 - From 10.0.0.0/8
  4. # TCP/443 - From 10.0.0.0/8
  5. # TCP/8080 - From 10.0.0.0/8
  6. # TCP/5432 - Outbound to 10.0.0.0/8
  7. #
  8. # New:
  9. # Ingress: TCP/8080 from LB, VPC-Access
  10. # Egress: TCP/5432 to local vpc
  11. resource "aws_security_group" "jira_server" {
  12. name_prefix = "jira_server"
  13. tags = merge(local.standard_tags, var.tags, { Name = "jira_server" })
  14. vpc_id = var.vpc_id
  15. description = "Jira Server"
  16. }
  17. #-----------------------------------------------------------------
  18. # Inbound access
  19. #-----------------------------------------------------------------
  20. resource "aws_security_group_rule" "jira_server_inbound_8080" {
  21. security_group_id = aws_security_group.jira_server.id
  22. type = "ingress"
  23. cidr_blocks = local.cidr_map["vpc-access"]
  24. from_port = 8080
  25. to_port = 8080
  26. protocol = "tcp"
  27. description = "Inbound 8080 (from access, for testing)"
  28. }
  29. #-----------------------------------------------------------------
  30. # Outbound access
  31. #-----------------------------------------------------------------
  32. resource "aws_security_group_rule" "jira_server_outbound_postgres" {
  33. security_group_id = aws_security_group.jira_server.id
  34. type = "egress"
  35. source_security_group_id = var.rds_sg
  36. from_port = 5432
  37. to_port = 5432
  38. protocol = "tcp"
  39. description = "Outbound postgres to RDS"
  40. }