main.tf 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. # Some instance variables
  2. locals {
  3. ami_selection = "minion" # master, minion, ...
  4. }
  5. # Rather than pass in the aws security group, we just look it up. This will
  6. # probably be useful other places, as well.
  7. data "aws_security_group" "typical-host" {
  8. name = "typical-host"
  9. vpc_id = var.vpc_id
  10. }
  11. # Use the default EBS key
  12. data "aws_kms_key" "ebs-key" {
  13. key_id = "alias/ebs_root_encrypt_decrypt"
  14. }
  15. resource "aws_security_group" "mailrelay_security_group" {
  16. name = "mailrelay_security_group"
  17. description = "Security Group for the Mail Relay Server(s)"
  18. vpc_id = var.vpc_id
  19. tags = merge(var.standard_tags, var.tags)
  20. }
  21. resource "aws_security_group_rule" "smtp-in" {
  22. description = "inbound smtp requests"
  23. type = "ingress"
  24. from_port = 25
  25. to_port = 25
  26. protocol = "tcp"
  27. cidr_blocks = [ "10.0.0.0/8" ]
  28. security_group_id = aws_security_group.mailrelay_security_group.id
  29. }
  30. #resource "aws_security_group_rule" "smtp-out" {
  31. # description = "outbound smtp requests"
  32. # type = "egress"
  33. # from_port = 25
  34. # to_port = 25
  35. # protocol = "tcp"
  36. # cidr_blocks = [ "10.0.0.0/8" ]
  37. # security_group_id = aws_security_group.mailrelay_security_group.id
  38. #}
  39. resource "aws_security_group_rule" "submission-out" {
  40. description = "outbound submission (smtp-s) requests"
  41. type = "egress"
  42. from_port = 587
  43. to_port = 587
  44. protocol = "tcp"
  45. cidr_blocks = [ "0.0.0.0/0" ]
  46. security_group_id = aws_security_group.mailrelay_security_group.id
  47. }