|
1 |
| -# terraform-aws-network-protocol-proxy |
| 1 | +# terraform-aws-network-protocol-proxy |
| 2 | + |
| 3 | +This terraform module provisions a simple, scalable tcp proxy based on haproxy. |
| 4 | +It deploys an EC2 autoscaling group behind a network load balancer (NLB), sets |
| 5 | +up cloudwatch logging, optionally configures a vpc endpoint service, and |
| 6 | +provides a configurable way to forward tcp traffic to any specified backend |
| 7 | +target. |
| 8 | + |
| 9 | +## how it works |
| 10 | + |
| 11 | +- an ec2 autoscaling group is created, each instance running haproxy |
| 12 | +- a network load balancer routes incoming traffic on tcp ports you define |
| 13 | +- haproxy listens on the same ports and forwards traffic to your backend |
| 14 | + target(s) |
| 15 | +- security group rules are created to allow ingress on the listener port from |
| 16 | + allowed cidrs |
| 17 | +- optional vpc endpoint service can be created if you need a private service endpoint |
| 18 | + |
| 19 | +## usage |
| 20 | + |
| 21 | +```hcl |
| 22 | +module "network_protocol_proxy" { |
| 23 | + source = "cruxstack/network-protocol-proxy/aws" |
| 24 | + version = "x.x.x" |
| 25 | +
|
| 26 | + name = "database-proxy" |
| 27 | + vpc_id = "vpc-1234567890abcdef" |
| 28 | + vpc_public_subnet_ids = ["subnet-1234abcd", "subnet-5678efgh"] |
| 29 | + vpc_private_subnet_ids = ["subnet-1234abcd", "subnet-5678efgh"] |
| 30 | + vpc_pr |
| 31 | +
|
| 32 | + proxies = { |
| 33 | + default = { |
| 34 | + target = "10.0.1.10:5432" |
| 35 | + listener_port = 10432 |
| 36 | + listener_allowed_cidrs = [ |
| 37 | + { |
| 38 | + cidr = "0.0.0.0/0" |
| 39 | + description = "allow all inbound for testing" |
| 40 | + } |
| 41 | + ] |
| 42 | + } |
| 43 | + } |
| 44 | +} |
| 45 | +``` |
| 46 | + |
| 47 | +## inputs |
| 48 | + |
| 49 | +| name | type | default | description | |
| 50 | +|--------------------------|--------------|---------|--------------------------------------------------------------| |
| 51 | +| `enabled` | bool | `true` | enable or disable the module | |
| 52 | +| `proxies` | object(...) | n/a | configuration for one or more haproxy proxies | |
| 53 | +| `capacity` | object(...) | `{}` | autoscaling desired, min, max settings | |
| 54 | +| `logs_bucket_name` | string | `""` | s3 bucket name for logs | |
| 55 | +| `ssm_sessions` | object(...) | `{}` | enable session manager logging | |
| 56 | +| `public_accessible` | bool | `false` | set to true to place the nlb in public subnets | |
| 57 | +| `eip_allocation_ids` | list(string) | `[]` | list of eip allocation ids for the nlb | |
| 58 | +| `vpc_id` | string | n/a | id of the vpc | |
| 59 | +| `vpc_private_subnet_ids` | list(string) | `[]` | list of private subnet ids | |
| 60 | +| `vpc_public_subnet_ids` | list(string) | `[]` | list of public subnet ids | |
| 61 | +| `vpc_security_group_ids` | list(string) | `[]` | additional security group ids to attach to the instances | |
| 62 | +| `vpc_endpoint_service` | object(...) | `{}` | configuration for optionally creating a vpc endpoint service | |
| 63 | +| `aws_account_id` | string | n/a | your aws account id | |
| 64 | +| `aws_kv_namespace` | string | n/a | your aws k/v namespace | |
| 65 | +| `aws_region_name` | string | n/a | the aws region | |
| 66 | +| `experimental_mode` | bool | n/a | toggles extra debug or development settings | |
| 67 | + |
| 68 | +## outputs |
| 69 | + |
| 70 | +| name | description | |
| 71 | +|-----------------|--------------------------------------| |
| 72 | +| `nlb_dns_name` | the dns name of the network lb (nlb) | |
| 73 | + |
0 commit comments