This terraform module creates an EC2 Cluster on AWS.
The following resources will be created:
- Elastic File System (EFS)
- Auto Scaling
- Security groups for (ALB/NLB,EC2,EFS)
- IAM roles and policies for the EC2 instances
In addition, you have the option to create:
-
Elastic Load Balancer
- ALB - An external Application Load Balancer
- NLB - An external Network Load Balancer
-
Route 53 (requires ALB)
- URL pointing to a hostname (NLB or ALB hostname)
Name | Version |
---|---|
terraform | >= 1.0.0 |
Name | Version |
---|---|
aws | n/a |
tls | n/a |
Name | Description | Type | Default | Required |
---|---|---|---|---|
ami_id | AMI to use (leave blank to use latest Amazon Linux 2) | string |
"" |
no |
certificate_arn | Certificate ARN to be used on the ALB | string |
"" |
no |
cwlog_files | List of log files to stream to cloudwatch logs (leave empty to disable the agent) - only for Amazon Linux 2 AMIs | list |
[] |
no |
ebs_encrypted | Encrypts EBS volume | bool |
true |
no |
ebs_kms_key_id | Encrypts EBS volume with custom KMS key (requires ebs_encrypted=true) | string |
"" |
no |
ebs_mount_dir | Custom EBS mount point - e.g /home | string |
"/mnt/ebs" |
no |
ebs_size | Size of EBS volumes in GB | number |
40 |
no |
ebs_type | EBS volume type | string |
"gp2" |
no |
efs_mount_dir | Custom EFS mount point - e.g /home | string |
"/mnt/efs" |
no |
efs_subnet_ids | List of secure subnet IDs for EFS | list(any) |
[] |
no |
fs_type | Filesystem persistency to use: EFS or EBS | string |
"EFS" |
no |
hosted_zone | Route 53 hosted zone | string |
"" |
no |
hostname_create | Wheter to create the hostnames on Route 53 | bool |
false |
no |
hostnames | Hostnames to be created on Route 53 | list(string) |
[] |
no |
http_port | HTTP port to listen (only when lb_type is ALB | number |
80 |
no |
instance_count | Number of EC2 intances | number |
1 |
no |
instance_type | EC2 instance type | string |
"t2.micro" |
no |
instances_subnet_ids | List of private subnet IDs for EC2 instances (same number as instance_count) | list(any) |
n/a | yes |
launch_template_id | Uses an existing launch template | string |
"" |
no |
lb_scheme | Wheter to use an external ALB/NLB or internal (not applicable for EIP) | string |
"external" |
no |
lb_subnet_ids | List of subnet IDs for the ALB/NLB | list(any) |
[] |
no |
lb_type | Either ALB, NLB or EIP to enable | string |
"" |
no |
name | Name of this EC2 Instance | string |
n/a | yes |
on_demand_base_capacity | on_demand_base_capacity | number |
0 |
no |
on_demand_percentage | on_demand_percentage | number |
0 |
no |
security_group_ids | Extra security groups for instances | list(any) |
[] |
no |
sg_cidr_blocks | Which cidr blocks allowed to connect to the service | list(any) |
[] |
no |
sg_custom_egress_rules | Which cidr blocks allowed to connect to the service | list(object({ |
[] |
no |
sg_custom_ingress_rules | Which cidr blocks allowed to connect to the service | list(object({ |
[] |
no |
tags | Additional resource tags | map(string) |
{} |
no |
tcp_ports | List TCP ports to listen (only when lb_type is NLB or EIP) | list(any) |
[] |
no |
udp_ports | List of UDP ports to listen (only when lb_type is NLB or EIP) | list(any) |
[] |
no |
userdata | Extra commands to pass to userdata | string |
"" |
no |
vpc_id | VPC ID to deploy the EC2/default cluster | string |
n/a | yes |
No output.
Module managed by DNX Solutions.
Apache 2 Licensed. See LICENSE for full details.