main.tf 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. resource "aws_route53_resolver_endpoint" "private_resolver" {
  2. name = "xdr_msoc_local"
  3. direction = "INBOUND"
  4. security_group_ids = [aws_security_group.resolver_security_group.id]
  5. dynamic "ip_address" {
  6. for_each = var.subnets
  7. content {
  8. subnet_id = ip_address.value
  9. }
  10. }
  11. tags = merge(local.standard_tags, var.tags)
  12. }
  13. #----------------------------------------------------------------------------
  14. # DNS Resolver Security Group
  15. #----------------------------------------------------------------------------
  16. resource "aws_security_group" "resolver_security_group" {
  17. # checkov:skip=CKV2_AWS_5: this SG is attached to DNS Resolver
  18. name = "route53_resolver_inbound"
  19. description = "Allow DNS inbound traffic"
  20. vpc_id = var.primary_vpc
  21. #----------------------------------------------------------------------------
  22. # INGRESS
  23. #----------------------------------------------------------------------------
  24. ingress {
  25. description = "DNS_UDP - Inbound"
  26. from_port = 53
  27. to_port = 53
  28. protocol = "udp"
  29. cidr_blocks = ["10.0.0.0/8"]
  30. }
  31. ingress {
  32. description = "DNS_TCP - Inbound"
  33. from_port = 53
  34. to_port = 53
  35. protocol = "tcp"
  36. cidr_blocks = ["10.0.0.0/8"]
  37. }
  38. #----------------------------------------------------------------------------
  39. # EGRESS
  40. #----------------------------------------------------------------------------
  41. egress {
  42. description = "DNS_UDP - Outbound"
  43. from_port = 53
  44. to_port = 53
  45. protocol = "udp"
  46. cidr_blocks = ["10.0.0.0/8"]
  47. }
  48. egress {
  49. description = "DNS_TCP - Outbound"
  50. from_port = 53
  51. to_port = 53
  52. protocol = "tcp"
  53. cidr_blocks = ["10.0.0.0/8"]
  54. }
  55. tags = merge(local.standard_tags, var.tags)
  56. }