ElastAlert
View SourceRelease NotesThis folder contains a Terraform module to deploy ElastAlert on top of an Auto Scaling Group of exactly one EC2 instance.
The idea is to create an Amazon Machine Image (AMI) that has ElastAlert installed using the install-elastalert module.
Sample Usage
- Terraform
- Terragrunt
# ------------------------------------------------------------------------------------------------------
# DEPLOY GRUNTWORK'S ELASTALERT MODULE
# ------------------------------------------------------------------------------------------------------
module "elastalert" {
source = "git::git@github.com:gruntwork-io/terraform-aws-elk.git//modules/elastalert?ref=v0.11.1"
# ----------------------------------------------------------------------------------------------------
# REQUIRED VARIABLES
# ----------------------------------------------------------------------------------------------------
# The ID of the AMI to run in this cluster.
ami_id = <INPUT REQUIRED>
# The type of EC2 Instances to run for each node in the cluster (e.g. t2.micro).
instance_type = <INPUT REQUIRED>
# The subnet IDs into which the EC2 Instances should be deployed.
subnet_ids = <INPUT REQUIRED>
# A User Data script to execute while the server is booting.
user_data = <INPUT REQUIRED>
# The ID of the VPC in which to deploy the kibana cluster
vpc_id = <INPUT REQUIRED>
# ----------------------------------------------------------------------------------------------------
# OPTIONAL VARIABLES
# ----------------------------------------------------------------------------------------------------
# A list of IP address ranges in CIDR format from which SSH access will be
# permitted. Attempts to access the bastion host from all other IP addresses will
# be blocked.
allow_ssh_from_cidr_blocks = []
# The IDs of security groups from which SSH connections will be allowed. If you
# update this variable, make sure to update var.num_ssh_security_group_ids too!
allow_ssh_from_security_group_ids = []
# If set to true, associate a public IP address with each EC2 Instance in the
# cluster.
associate_public_ip_address = false
# Path in which to create the IAM instance profile.
instance_profile_path = "/"
# Wait for this number of EC2 Instances to show up healthy in the load balancer on
# creation.
min_elb_capacity = 0
# The module's name that will be used to prefix various AWS resource names.
name_prefix = "elastalert-"
# The number of security group IDs in var.allow_ssh_from_security_group_ids. We
# should be able to compute this automatically, but due to a Terraform limitation,
# if there are any dynamic resources in var.allow_ssh_from_security_group_ids,
# then we won't be able to: https://github.com/hashicorp/terraform/pull/11482
num_ssh_security_group_ids = 0
# The name of an EC2 Key Pair that can be used to SSH to the EC2 Instances in this
# cluster. Set to an empty string to not associate a Key Pair.
ssh_key_name = null
# The port used for SSH connections
ssh_port = 22
# List fo extra tag blocks added to the autoscaling group configuration. Each
# element in the list is a map containing keys 'key', 'value', and
# 'propagate_at_launch' mapped to the respective values.
tags = []
# A list of target group ARNs to associate with the Kibana cluster.
target_group_arns = []
# A maximum duration that Terraform should wait for the EC2 Instances to be
# healthy before timing out.
wait_for_capacity_timeout = "10m"
}
# Coming soon!
Reference
- Inputs
- Outputs
Required
ami_idstringThe ID of the AMI to run in this cluster.
instance_typestringThe type of EC2 Instances to run for each node in the cluster (e.g. t2.micro).
subnet_idslist(string)The subnet IDs into which the EC2 Instances should be deployed.
user_datastringA User Data script to execute while the server is booting.
vpc_idstringThe ID of the VPC in which to deploy the kibana cluster
Optional
allow_ssh_from_cidr_blockslist(string)A list of IP address ranges in CIDR format from which SSH access will be permitted. Attempts to access the bastion host from all other IP addresses will be blocked.
[]allow_ssh_from_security_group_idslist(string)The IDs of security groups from which SSH connections will be allowed. If you update this variable, make sure to update num_ssh_security_group_ids too!
[]If set to true, associate a public IP address with each EC2 Instance in the cluster.
falseinstance_profile_pathstringPath in which to create the IAM instance profile.
"/"min_elb_capacitynumberWait for this number of EC2 Instances to show up healthy in the load balancer on creation.
0name_prefixstringThe module's name that will be used to prefix various AWS resource names.
"elastalert-"The number of security group IDs in allow_ssh_from_security_group_ids. We should be able to compute this automatically, but due to a Terraform limitation, if there are any dynamic resources in allow_ssh_from_security_group_ids, then we won't be able to: https://github.com/hashicorp/terraform/pull/11482
0ssh_key_namestringThe name of an EC2 Key Pair that can be used to SSH to the EC2 Instances in this cluster. Set to an empty string to not associate a Key Pair.
nullssh_portnumberThe port used for SSH connections
22tagslist(object(…))List fo extra tag blocks added to the autoscaling group configuration. Each element in the list is a map containing keys 'key', 'value', and 'propagate_at_launch' mapped to the respective values.
list(object({
key = string
value = string
propagate_at_launch = bool
}))
[]Example
default = [
{
key = "foo"
value = "bar"
propagate_at_launch = true
}
]
target_group_arnslist(string)A list of target group ARNs to associate with the Kibana cluster.
[]A maximum duration that Terraform should wait for the EC2 Instances to be healthy before timing out.
"10m"