security-groups.tf 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. # Rather than pass in the aws security group, we just look it up. This will
  2. # probably be useful other places, as well.
  3. #----------------------------------------------------------------------------
  4. # TQ Security Group
  5. #----------------------------------------------------------------------------
  6. data "aws_security_group" "typical-host" {
  7. name = "typical-host"
  8. vpc_id = var.vpc_id
  9. }
  10. data "aws_security_group" "aws_endpoints" {
  11. name = "aws_endpoints"
  12. vpc_id = var.vpc_id
  13. }
  14. resource "aws_security_group" "instance" {
  15. name = local.server_name_stem
  16. description = "${local.server_name_stem} Instances"
  17. vpc_id = var.vpc_id
  18. tags = merge(local.standard_tags, var.tags)
  19. }
  20. #----------------------------------------------------------------------------
  21. # INGRESS
  22. #----------------------------------------------------------------------------
  23. resource "aws_security_group_rule" "instance-https-in" {
  24. type = "ingress"
  25. description = "Access TQ/TQ API from internal IPs"
  26. from_port = "443"
  27. to_port = "443"
  28. protocol = "tcp"
  29. cidr_blocks = local.supernets
  30. security_group_id = aws_security_group.instance.id
  31. }