security-groups.tf 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. # Several of these security groups will have customer IPs listed in them to allow
  2. # POP systems to access our services.
  3. #
  4. locals {
  5. }
  6. module "aws_endpoints_sg" {
  7. use_name_prefix = false
  8. source = "terraform-aws-modules/security-group/aws"
  9. version = "= 4.0.0"
  10. name = "aws_endpoints"
  11. tags = merge(var.standard_tags, var.tags)
  12. vpc_id = module.vpc.vpc_id
  13. ingress_cidr_blocks = [ "10.0.0.0/8" ]
  14. egress_cidr_blocks = [ "10.0.0.0/8" ]
  15. egress_ipv6_cidr_blocks = [ ]
  16. egress_rules = [ "all-all" ]
  17. ingress_rules = [ "all-all" ]
  18. }
  19. # "Allow
  20. module "allow_all_from_trusted_sg" {
  21. use_name_prefix = false
  22. source = "terraform-aws-modules/security-group/aws"
  23. version = "= 4.0.0"
  24. name = "allow-all-from-trusted"
  25. tags = merge(var.standard_tags, var.tags)
  26. vpc_id = module.vpc.vpc_id
  27. ingress_cidr_blocks = concat(var.trusted_ips, [ "10.0.0.0/8" ])
  28. egress_cidr_blocks = [ "0.0.0.0/0" ]
  29. ingress_rules = [ "all-all" ]
  30. egress_rules = [ "all-all" ]
  31. }
  32. module "allow_all_outbound_sg" {
  33. use_name_prefix = false
  34. source = "terraform-aws-modules/security-group/aws"
  35. version = "= 4.0.0"
  36. name = "allow-all-outbound"
  37. tags = merge(var.standard_tags, var.tags)
  38. vpc_id = module.vpc.vpc_id
  39. egress_rules = [ "all-all" ]
  40. }
  41. module "typical_host_security_group" {
  42. source = "../../submodules/security_group/typical_host"
  43. vpc_id = module.vpc.vpc_id
  44. cidr_map = var.cidr_map
  45. tags = merge(var.standard_tags, var.tags)
  46. aws_region = var.aws_region
  47. aws_partition = var.aws_partition
  48. aws_endpoints_sg = module.aws_endpoints_sg.security_group_id
  49. }
  50. # CIS 4.3 - Default security group should restrict all traffic
  51. #
  52. # This resource is special, and clears out existing rules. See:
  53. # See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_security_group
  54. resource "aws_default_security_group" "default" {
  55. vpc_id = module.vpc.vpc_id
  56. tags = merge(var.standard_tags, var.tags)
  57. }