|
| 1 | +# terraform-aws-teleport-node |
| 2 | + |
| 3 | +Provision a small, self-healing fleet of EC2 instances that automatically join |
| 4 | +an **existing Teleport Cloud** cluster. The nodes can run the Teleport **Node, |
| 5 | +App, or Database** services and implements AWS EC2 best practices. |
| 6 | + |
| 7 | +--- |
| 8 | + |
| 9 | +## Features |
| 10 | + |
| 11 | +* **One-Command Deploy** – Launches an Auto Scaling Group behind the scenes; |
| 12 | + nodes bootstrap themselves via cloud-init and join Teleport Cloud |
| 13 | + automatically. |
| 14 | +* **Always-latest Build** – Each instance queries the Teleport download |
| 15 | + endpoint and installs the newest stable Cloud release at boot. |
| 16 | +* **Spot-friendly** – Supports mixed-instance/spot policies for cost savings. |
| 17 | +* **Integrated Observability** – System, cloud-init and Teleport logs are |
| 18 | + streamed to a dedicated CloudWatch Log Group; optional SSM session |
| 19 | + transcripts to S3. |
| 20 | +* **Database Service Ready** – IAM & RDS/Redshift permissions wired in when |
| 21 | + `tp_config.db_service.enabled = true`, enabling discovery and IAM auth. |
| 22 | +* **Hygienic Networking & IAM** – No public IPs, IMDSv2 enforced, least-priv |
| 23 | + policies, single inbound rule limited to the SG itself for Teleport gossip. |
| 24 | + |
| 25 | +--- |
| 26 | + |
| 27 | +## Usage |
| 28 | + |
| 29 | +```hcl |
| 30 | +module "teleport_nodes" { |
| 31 | + source = "github.com/cruxstack/terraform-aws-teleport-node" |
| 32 | + version = "x.x.x" |
| 33 | +
|
| 34 | + tp_domain = "acme.teleport.sh" |
| 35 | + tp_join_config = { |
| 36 | + token_name = "iam-role" |
| 37 | + } |
| 38 | +
|
| 39 | + vpc_id = "vpc-1234567890abcdef" |
| 40 | + vpc_subnet_ids = ["subnet-1234abcd", "subnet-5678efgh"] |
| 41 | +} |
| 42 | +``` |
| 43 | + |
| 44 | +--- |
| 45 | + |
| 46 | +## Inputs |
| 47 | +In addition to the variables documented below, this module includes several |
| 48 | +other optional variables (e.g., `name`, `tags`, etc.) provided by the |
| 49 | +`cloudposse/label/null` module. Please refer to its [documentation](https://registry.terraform.io/modules/cloudposse/label/null/latest) |
| 50 | +for more details on these variables. |
| 51 | + |
| 52 | +| Name | Description | Type | Default | Required | |
| 53 | +| ---------------------------------------- | --------------------------------------------------------------------------------------- | :-------------------: | :--------------------: | :------: | |
| 54 | +| `tp_domain` | Teleport Cloud cluster FQDN (e.g. `example.teleport.sh`). | `string` | — | **yes** | |
| 55 | +| `tp_join_config` | Join token config.<br>`token_name` (required) and optional `method` (`iam` \| `token`). | `object({...})` | — | **yes** | |
| 56 | +| `tp_edition` | Teleport edition (`cloud`, `ent`, …). | `string` | `"cloud"` | no | |
| 57 | +| `tp_config` | Extra Teleport service configuration (enable DB/App/SSH, label rules, etc.). | `object({...})` | `{}` | no | |
| 58 | +| `instance_capacity` | ASG desired/min/max. | `object({...})` | `{ min = 1, max = 3 }` | no | |
| 59 | +| `instance_types` | List of allowed instance types & weights. | `list(object({...}))` | see `variables.tf` | no | |
| 60 | +| `instance_key_name` | Existing EC2 key-pair name (ssh access). | `string` | `""` | no | |
| 61 | +| `instance_spot` | Spot settings (`enabled`, `allocation_strategy`). | `object({...})` | `{ enabled = true }` | no | |
| 62 | +| `logs_bucket_name` | S3 bucket for generic logs (unused by SSM). | `string` | `""` | no | |
| 63 | +| `ssm_sessions` | Toggle SSM logging and target bucket. | `object({...})` | `{ enabled = false }` | no | |
| 64 | +| `vpc_id` | Target VPC ID. | `string` | — | **yes** | |
| 65 | +| `vpc_subnet_ids` | Subnet IDs for the ASG. | `list(string)` | `[]` | **yes** | |
| 66 | +| `vpc_security_group_ids` | Extra SGs to attach. | `list(string)` | `[]` | no | |
| 67 | +| `experimental_mode` | Shorter CW log retention & zero-health refresh for dev. | `bool` | `false` | no | |
| 68 | + |
| 69 | +--- |
| 70 | + |
| 71 | +## Outputs |
| 72 | + |
| 73 | +| Name | Description | |
| 74 | +| --------------------- | ----------------------------------------------- | |
| 75 | +| `teleport_version` | The Teleport version installed on the nodes. | |
| 76 | +| `teleport_config` | Fully-rendered Teleport YAML that was injected. | |
| 77 | +| `security_group_id` | ID of the generated node SG. | |
| 78 | +| `security_group_name` | Name of the generated node SG. | |
| 79 | + |
0 commit comments