security-groups.tf 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. endpoint_cidr_blocks = var.allow_any_to_endpoints ? ["10.0.0.0/8"] : [module.vpc.vpc_cidr_block]
  6. }
  7. module "aws_endpoints_sg" {
  8. use_name_prefix = false
  9. source = "terraform-aws-modules/security-group/aws"
  10. version = "= 4.0.0"
  11. name = "aws_endpoints"
  12. tags = merge(local.standard_tags, var.tags)
  13. vpc_id = module.vpc.vpc_id
  14. ingress_cidr_blocks = local.endpoint_cidr_blocks
  15. egress_cidr_blocks = local.endpoint_cidr_blocks
  16. egress_ipv6_cidr_blocks = []
  17. egress_rules = ["all-all"]
  18. ingress_rules = ["all-all"]
  19. }
  20. # "Allow
  21. module "allow_all_from_trusted_sg" {
  22. use_name_prefix = false
  23. source = "terraform-aws-modules/security-group/aws"
  24. version = "= 4.0.0"
  25. name = "allow-all-from-trusted"
  26. tags = merge(local.standard_tags, var.tags)
  27. vpc_id = module.vpc.vpc_id
  28. ingress_cidr_blocks = local.trusted_ips
  29. egress_cidr_blocks = ["0.0.0.0/0"]
  30. ingress_rules = ["all-all"]
  31. egress_rules = ["all-all"]
  32. }
  33. module "allow_all_outbound_sg" {
  34. use_name_prefix = false
  35. source = "terraform-aws-modules/security-group/aws"
  36. version = "= 4.0.0"
  37. name = "allow-all-outbound"
  38. tags = merge(local.standard_tags, var.tags)
  39. vpc_id = module.vpc.vpc_id
  40. egress_rules = ["all-all"]
  41. }