fbpx

Elastigroup

This post demonstrates how to create an Elastigroup using the Spotinst Terraform plugin.

This post assumes that you already have a Spotinst account and went through Spotinst Terraform Installation & Configuration.

Creating an Elastigroup HCL

Terraform is a tool for building, changing, and versioning infrastructure safely and efficiently. Terraform can manage existing and popular service providers as well as custom in-house solutions. Terraform uses configuration files to describe the components needed to run a single application or your entire infrastructure. Terraform generates an execution plan describing what it will do to reach the desired state, and then executes it to build the described infrastructure. Terraform supports many cloud providers and platforms including of course, Spotinst. You can easily create and manage Spotinst Elastigroups from within your Terraform template to take full advantage of the Spotinst platform.

#Importing an Existing Elastigroup

#Argument-reference

#General

#Roll Configuration

#Capacity

#Strategy

#Compute

#Scaling policies

#Integrations

#Notifications

#Health Check Service (HCS)

Example Usage – Creating an Elastigroup HCL

# Create an Elastigroup
resource "spotinst_aws_group" "sidekiq" {
  name        = "sidekiq"
  description = "created by Terraform"
  product     = "Linux/UNIX"
  target_capacity = 10
  capacity {
    minimum = 5
    maximum = 25
  }

  strategy {
    risk                 = 100
    fallback_to_ondemand = true
  }

  instance_types {
    ondemand = "m3.xlarge"
    spot = [
      "m3.xlarge",
      "m3.2xlarge"
    ]
  }

  availability_zones = [
    "us-west-2a:subnet-45699e0b"
    "us-west-2b:subnet-338f5353"
    "us-west-2c:subnet-338f5355"
  ]

  launch_specification {
    monitoring = false
    image_id   = "ami-1e299d75"
    key_pair   = "spotinst-oregon"

    security_group_ids = [
      "sg-3d10b646"
    ]
  }

  ebs_block_device {
    device_name           = "/dev/sda1"
    volume_size           = 30
    delete_on_termination = true
  }

  scaling_up_policy {
    policy_name        = "Sidkiq Scaling Up Policy"
    metric_name        = "SidekiqQueuesDepth"
    statistic          = "average"
    unit               = "none"
    adjustment         = 1
    namespace          = "custom"
    threshold          = 100
    period             = 60
    evaluation_periods = 5
    cooldown           = 300
  }

  scaling_down_policy {
    policy_name        = "Sidkiq Scaling Down Policy"
    metric_name        = "SidekiqQueuesDepth"
    statistic          = "average"
    unit               = "none"
    adjustment         = 1
    namespace          = "custom"
    threshold          = 10
    period             = 60
    evaluation_periods = 10
    cooldown           = 300
  }

  instance_type_weights = [
  {
    instance_type = "c3.large"
    weight        = 10
  },
  {
    instance_type = "c4.xlarge"
    weight        = 16
  },
  ]

  tags {
    "Env"     = "production"
    "Name"    = "sidekiq-production"
    "Project" = "app_v2"
    "Roles"   = "app;sidekiq"
  }

  lifecycle {
    ignore_changes = [
      "capacity"
    ]
  }
}

Importing an Existing Elastigroup

You can easily import an existing Elastigorup via the following command:

terraform import spotinst_aws_group.name-of-resource-in-terraform sig-12345

Note: This will only import the state to the machine’s memory, and you will have to create the configuration by yourself, as configuration creation is not yet supported in TF. Please see: https://www.terraform.io/docs/import/

Argument Reference

General

name – (Optional) The group name.

description – (Optional) The group description.

product – (Required) Operation system type.
Supported values: Linux/UNIX | SUSE Linux | Windows

region – The AWS region your group will be created in.
Note: This parameter is required if you specify subnets (through subnet_ids). This parameter is optional if you specify Availability Zones (through availability_zones).

 

In case you want to launch instances in VPC in EC2 Classic regions: Linux/UNIX (Amazon VPC) | SUSE Linux (Amazon VPC) | Windows (Amazon VPC)

name = "terraform"
description = "terraform"
product = "Linux/UNIX"
Roll Configuration

roll_config – (Optional) While used, you can control whether the group should perform a deployment after an update to the configuration

should_ roll – (boolean) – (Required) – sets the enablement of the roll option

batch_size_percentage – (integer) – (Required) – Sets the percentage of the instances to deploy in each batch

grace_period – (integer) – (Optional) – Sets the grace period for new instances to become healthy

health_check_type – (string) – (Optional) – Sets the health check type to use. Supported values: “EC2”, “ELB”, “HCS”, “MLB” and “TARGET_GROUP”

roll_config {
should_roll = false 
batch_size_percentage = 20
grace_period = 600
health_check_type = "EC2" 
}
Capacity

target_capacity – (Required) The desired number of instances the group should have at any time.

capacity – (Required) The group capacity. Only a single block is allowed.

minimum – (Optional; Required if using scaling policies) The minimum number of instances the group should have at any time.

maximum – (Optional; Required if using scaling policies) The maximum number of instances the group should have at any time.

unit – (Optional). The capacity unit to launch instances by. if not specified, when choosing the weight unit, each instance will weigh as the number of its vCPUs.

Optional values : instance(default) | weight

target_capacity = 0
capacity {
minimum = 0
maximum = 5
unit = "weight"
}
Weights

instance_type_weights – (Optional) Allows you to set custom weights for the instances in the cluster – this will only be used for Elastigroups that have this setting enabled in the unit field

instance_type – (Optional) The instance type you would like to assign the weight value

weight – (Optional) the assigned weight for the instance

instance_type_weights = [
  {
    instance_type = "c3.large" 
    weight = 10
  },
  {
    instance_type = "c4.xlarge" 
    weight = 16
  },
  ]
Strategy

strategy – (Required) This determines how your group request is fulfilled from the possible On-Demand and Spot pools selected for launch. Only a single block is allowed.

availability_vs_cost – (Optional) The percentage of Spot instances that would spin up from the capacity target number.

Supported Values: costOriented | availabilityOriented | balanced | equalAzDistribution

draining_timeout – (Optional) The time in seconds, the instance is allowed to run while detached from the ELB. This is to allow the instance time to be drained from incoming TCP connections before terminating it, during a scale down operation.

risk – (Optional; Required if not using ondemand_count) The percentage of Spot instances that would spin up from the capacity.target number.

ondemand_count – (Optional; Required if not using risk) Number of on-demand instances to launch in the group. All other instances will be spot instances. When this parameter is set the “risk” parameter is being ignored.

Utilize_Reserved_Instances – (Optional). In a case of any available reserved instances, Elastigroup will utilize them first before purchasing Spot instances

fallback_to_ondemand – (Optional). In a case of no Spot instances available, Elastigroup will launch on-demand instances instead.

strategy {
availability_vs_cost = "balanced"
draining_timeout = 600
risk = 100
utilize_reserved_instances = true
fallback_to_ondemand = true
}
Compute

Instance Types

instance_types – The type of instance determines your instance’s CPU capacity, memory and storage (e.g., m1.small, c1.xlarge).

ondemand – (Required) The base instance type.

spot – (Required) One or more instance types.

instance_types {
ondemand = "c3.large"
spot = ["c3.large", "m4.xlarge"]
}

Subnet Ids

subnet_ids – A comma-separated list of subnet identifiers.

subnet_ids = [
"subnet-4c1d1538",
"subnet-2791bb61",
"subnet-703a6f58"
]

Note: When this parameter is set, availability_zones should be left unused.

Availability Zone

One or multiple. Each availability_zone supports the following:

name – The name of the availability zone.

subnet_id – (Optional) A specific subnet ID within the given availability zone. If not specified, the default subnet will be used.

availability_zones = [
"us-east-1a",
"us-east-1b",
"us-east-1c:subnet_ab123"
]

Note: When this parameter is set, subnet_ids should be left unused.

AMI image

image_id – (Required) The ID of the AMI used to launch the instance.

image_id = "ami-f0091d91"

Private IP pool

private_ips – (Optional) List of Private IPs to associate to the group instances.(e.g. “172.1.1.0”). Please note: This setting will only apply if persistence.persist_private_ip is set to true.

private_ips = ["1.2.3.4", "99.88.77.66"]

Launch Specification

launch_specification – (Required) Describes the launch specification for an instance.

monitoring – (Optional) Indicates whether monitoring is enabled for the instance.

key_pair – (Optional) The key name that should be used for the instance.

health_check_type – (Optional) The service that will perform health checks for the instance. Supported values : ELB | HCS | TARGET_GROUP | CUSTOM | K8S_NODE

health_check_grace_period – (Optional) The amount of time, in seconds, after the instance has launched to starts and check its health

health_check_unhealthy_duration_before_replacement
– (Optional) The amount of time, in seconds, that we will wait before replacing an instance that is running and became unhealthy (this is only applicable for instances that were once healthy)

security_group_ids – (Optional) A list of associated security group IDS.

user_data – (Optional) The user data to provide when launching the instance.

shutdown_script – (Optional) The script that will execute before instance starts shutting down.

iam_instance_profile – (Optional) The ARN of an IAM instance profile to associate with launched instances.

launch_specification {
monitoring = false
key_pair = "east"
health_check_type = "ELB"
health_check_grace_period = 300
security_group_ids = ["default", "sg-123"]
user_data = "#!/bin/sh echo hello"
shutdown_script = "#!/bin/sh echo hello"
iam_instance_profile = "admin" }

Load Balancers

AWS Load Balancers:

name – (Required). The resource name

type – (Required). The resource type. Optional values :classic | target_group

arn – (Optional; required only for target groups) The resource arn

load_balancer {
name = "tg2"
type = "target_group"
arn = "arn:aws:elasticloadbalancing:us-east-1:123456789:targetgroup/tg2/1fe63217f8ffcc06"
}
load_balancer {
name = "tg2"
type = "classic"

}

Multai Load Balancer:

balancer_id – (Required) – Your Multai balancer ID

target_set_id – (Required) – Your Multai target set ID

load_balancer {
type = "MULTAI_TARGET_SET"
balancer_id = "lb-e48117be2b26"
target_set_id = "ts-762b6ae0038b"
}

Tags

tags – (Optional) A mapping of tags to assign to the resource.

tags {
foo = "bar"
bar = "baz"
}

Elastic IPs

elastic_ips – (Optional) List of ElasticIps Allocation Ids to associate to the group’s instances.

elastic_ips = [
"eipalloc-01",
"eipalloc-02"
]

Stateful

We support instance persistence via the following configurations. all values are boolean.

For more information on instance persistence please see: Stateful configuration

persist_root_device – (Optional) Boolean, should the instance maintain its root device volumes.

persist_block_devices – (Optional) Boolean, should the instance maintain its Data volumes

block_device_mode – (Optional) String, determine the way we attach the data volumes to the data devices, possible values: ‘reattach’ and ‘onLaunch’ (default is onLaunch)

persist_private_ip – (Optional) Boolean, should the instance maintain its private IP

persistence {
 persist_root_device = true
 persist_block_devices = true
 block_devices_mode = "reattach"
 persist_private_ip = true
}

Resume Stateful instances

should_resume_stateful – (Optional) Boolean, this will apply resuming action for Stateful instances in the Elastigroup upon scale up or capacity changes. Example usage will be for Elastigroups that will have schedualing rules to set a target capacity of 0 instnaces in the night and automatically restore the same state of the isntnaces in the morning.

should_resume_stateful=true

Block Devices

Each of the *_block_device attributes controls a portion of the AWS Instance’s “Block Device Mapping”. It’s a good idea to familiarize yourself with AWS’s Block Device Mapping docs to understand the implications of using these attributes.

1. Each ebs_block_device supports the following:

device_name – (Required). The name of the device to mount.

snapshot_id – (Optional) The Snapshot ID to mount.

volume_type – (Optional) The type of volume. Can be "standard", "gp2", or "io1".

volume_size – (Optional) The size of the volume in gigabytes.

iops – (Optional) The amount of provisioned IOPS. This must be set with a volume_type of "io1".

delete_on_termination – (Optional) Whether the volume should be destroyed on instance termination.

encrypted – (Optional) Enables EBS encryption on the volume.

//optional
data "aws_ami" "amazon_linux" {
most_recent = true

name_regex = "amzn-ami-hvm-.*-gp2"
owners = ["amazon"]
}
//optional

ebs_block_device { device_name = “${data.aws_ami.amazon_linux.root_device_name}” volume_type = ‘gp2’ volume_size = 80 delete_on_termination = true }
ebs_block_device { device_name = “/dev/xvdb” snapshot_id = ‘snap-12345678’ volume_type = ‘io1’ volume_size = 80 iops = 100 delete_on_termination = true encrypted = true }

Modifying any ebs_block_device currently resource replacement.

Using the default AMi is optional, any AMI can be used.

2. Each ephemeral_block_device supports the following:

device_name – The name of the block device to mount on the instance.

virtual_name – The Instance Store Device Name(e.g. "ephemeral0").

ephemeral_block_device {
device_name = "/dev/xvdc"
virtual_name = "ephemeral0"
}

Currently, changes to *_block_device configuration of existing resources cannot be automatically detected by Terraform. After making updates to block device configuration, resource recreation can be manually triggered by using the taint command.

Network Interfaces

Each of the network_interface attributes controls a portion of the AWS Instance’s “Elastic Network Interfaces”. It’s a good idea to familiarize yourself witsh AWS’s Elastic Network Interfaces docs to understand the implications of using these attributes.

Please note: if you wish for instances to have a specific Private IP you should use Private IP pools along with Stateful configuration.

network_interface_id – (Optional) The ID of the network interface.

device_index – (requierd) The index of the device on the instance for the network interface attachment.

subnet_id – (Optional) The ID of the subnet associated with the network string.

description – (requierd) The description of the network interface.

private_ip_address – (Optional) The private IP address of the network interface.

security_group_ids – (Optional) The IDs of the security groups for the network interface.

delete_on_termination – (Optional) If set to true, the interface is deleted when the instance is terminated.

secondary_private_ip_address_count – (Optional) The number of secondary private IP addresses.

associate_public_ip_address – (Optional) Indicates whether to assign a public IP address to an instance you launch in a VPC. The public IP address can only be assigned to a network interface for eth0, and can only be assigned to a new network interface, not an existing one.

network_interface {
network_interface_id = "bar"
device_index = 0
subnet_id = "foo"
description = "foo"
private_ip_address = "172.0.0.1"
security_group_ids = ["sg-foo"]
delete_on_termination = false
secondary_private_ip_address_count = 1
associate_public_ip_address = false
}

Scheduler

Each scheduled_task supports the following:

task_type – (Required) The task type to run. Optional values : backup_ami | scale | roll | statefulUpdateCapacity

is_enabled – (optional) setting the task to being enabled or disabled. Optional values : true | false

cron_expression – (Optional; Required if not using frequency) A valid cron expression. The cron is running in UTC time zone and is in Unix cron format.

frequency – (Optional; Required if not using cron_expression) The recurrence frequency to run this task. Supported values are hourly, daily and weekly.

scale_target_capcity – (Optional) The desired number of instances the group should have.

scale_min_capcity – (Optional) The minimum number of instances the group should have.

scale_max_capcity – (Optional) The maximum number of instances the group should have.

target_capcity – (Optional – only valid for statefulUpdateCapacity) The desired number of instances the group should have.

min_capcity – (Optional – only valid for statefulUpdateCapacity) The minimum number of instances the group should have.

max_capcity – (Optional – only valid for statefulUpdateCapacity) The maximum number of instances the group should have.

scheduled_task {
task_type = "scale"
cron_expression = "0 5 * * 0-4"
scale_target_capacity = 2
scale_min_capcity = 0
scale_max_capcity = 10
}

scheduled_task {
task_type = "scale"
cron_expression = "0 20 * * 0-4"
scale_target_capacity = 0
}

scheduled_task {
task_type = "statefulUpdateCapacity"
cron_expression = "0 20 * * 0-4"
target_capacity = 0
} 
scheduled_task { 
task_type = "backup_ami"
is_enabled = true frequency = "hourly" }
Scaling Policies

Each scaling_*_policy supports the following:

Replace ‘*’ with “up” or “down”

policy_name – (Optional) The name of the policy

namespace – (Required) The namespace for the alarm’s associated metric. Default value is AWS/EC2

statistic – (Optional) The metric statistics to return. For information about specific statistics go to Statistics in the Amazon CloudWatch Developer Guide. Supported values: average | sum | sampleCount | maximum | minimum

metric_name – (Required) The name of the metric. Default value is CPUUtilization

operator – The operator to use in order to determine if the scaling policy is applicable. Supported values: gt | gte | lt | lte

threshold – (Required) The value against which the specified statistic is compared.

unit – (Optional) The unit for the alarm’s associated metric. Possible values: seconds | microseconds | milliseconds | bytes | kilobytes | megabytes | gigabytes | terabytes | bits | kilobits | megabits | gigabits | terabits | percent | count | bytes/second | kilobytes/second | megabytes/second | gigabytes/second | terabytes/second | bits/second | kilobits/second | megabits/second | gigabits/second | terabits/second | count/second | none

evaluation_periods – (Optional) The number of periods over which data is compared to the specified threshold.

period – (Optional) The granularity, in seconds, of the returned data points. The period must be at least 60 seconds and must be a multiplication of 60 (120, 180, 240 etc…).

action_type – (Optional; if not using min_target_capacity or max_target_capacity) The type of action to perform for scaling. Possible values :adjustment | percentageAdjustment | setMaxTarget | setMinTarget | updateCapacity

If you do not specify an action type, you can only use – adjustment, minTargetCapacity, maxTargetCapacity.

While using action_type, please also set the following:

  • when using adjustment – set the field “adjustment”
  • when using percentageAdjustment- set the field “adjustment”
  • when using setMaxTarget – set the field “max_target_capacity”
  • when using setMinTarget – set the field “min_target_capacity”
  • when using updateCapacity – set the fields “minimum”, “maximum”, and “target”
adjustment – (int – Optional; if not using min_target_capacity or max_target_capacity) The number of instances to add/remove to/from the target capacity when scale is needed.
adjustment_expression – (string – Optional; if not using min_target_capacity or max_target_capacity or adjustment;) The advanced expression to use for scaling of instances to add/remove to/from the target capacity when scale is needed. You can see more information here: Advanced expression. Example value: “MAX(currCapacity / 5, value * 10)”
min_target_capacity – (integer – Optional; if not using adjustment; available only for scale up). The number of the desired target (and minimum) capacity

max_target_capacity – (integer – Optional; if not using adjustment; available only for scale down). The number of the desired target (and maximum) capacity

minimum – (String – Optional; if using updateCapacity) The minimal number of instances to have in the group.

maximum – (String – Optional; if using updateCapacity) The maximal number of instances to have in the group.

target – (String – Optional; if using updateCapacity) The target number of instances to have in the group.

cooldown – (integer -Optional) The amount of time, in seconds, after a scaling activity completes and before the next scaling activity can start. If this parameter is not specified, the default cooldown period for the group applies.

dimensions – (Optional) A mapping of dimensions describing qualities of the metric.

scaling_up_policy {
policy_name = "Scaling Policy 1"
namespace = "AWS/EC2"
statistic = "average"
metric_name = "CPUUtilization"
operator = "gte"
threshold = 80
unit = "percent"
evaluation_periods = 2
period = 300
adjustment = 1
min_target_capacity = 30
max_target_capacity = 13
cooldown = 300
dimensions
}

Target Scaling

policy_name – (Optional) The name of the policy

namespace – (Required) The namespace for the alarm’s associated metric. Value supported is AWS/EC2

metric_name – (Required) The name of the metric. Default value is CPUUtilization, Other supported Values: NetworkIn, NetworkOut

statistic – (Optional) The metric statistics to return. Valid Values: average sum sampleCount maximum minimum

unit – (Optional) The unit for the alarm’s associated metric. Valid Values: seconds microseconds milliseconds bytes kilobytes megabytes gigabytes terabytes bits kilobits megabits gigabits terabits percent count bytes/second kilobytes/second megabytes/second gigabytes/second terabytes/second bits/second kilobits/second megabits/second gigabits/second terabits/second count/second none

target – (Optional) The target value for the group

cooldown – (Optional) The amount of time, in seconds, after a scaling activity completes before any further trigger-related scaling activities can start

scaling_target_policy {
policy_name        = "Test Scaling target Policy"
namespace          = "AWS/EC2"
metric_name        = "CPUUtilization"
statistic          = "average"
unit               = "percent"
target             = 50
cooldown           = 300
}

Signal

signal – (Optional) – The signals defined for this group.

name – (Required) – The name of the signal defined for the group. Possible values: INSTANCE_READY,INSTANCE_READY_TO_SHUTDOWN.

timeout – (Optional) – The signals defined timeout- default is 40 minutes (1800 seconds)

signal {
name = "INSTANCE_READY"
timeout = 900
}
Integrations

Rancher Integration

rancher_integration – (Optional) Describes the Rancher integration.

master_host – (Required) The URL of the Rancher Master host.

access_key – (Required) The access key of the Rancher API.

secret_key – (Required) The secret key of the Rancher API.

rancher_integration {
master_host = "localhost"
access_key = "foo"
secret_key = "bar"
}

Beanstalk Integration

elastic_beanstalk_integration – (Optional) Describes the [Elastic Beanstalk (https://aws.amazon.com/documentation/elastic-beanstalk/) integration definitions.

environment_id – (Required) The ID of the Elastic Beanstalk environment.

elastic_beanstalk_integration {
environment_id = "e-hc8mvnayrx"
}

Kubernetes Integration

kubernetes_integration – (Optional). Describes the Kubernetes integration definitions.

api_server – (Optional). URL for Kubernetes API Server

token – (Optional). Kubernetes Token

autoscale_is_enabled – (Optional). Enabling the k8s auto-scaler functionality. for more information please see: Kubernetes auto scaler

autoscale_cooldown – How long should the scaling should wait after the last scale action before initiating addition scaling action

autoscale_headroom – (Optional). An option to set compute reserve for the cluster

cpu_per_unit – (Optional). How much CPU to allocate for headroom unit

memory_per_unit – (Optional). How much Memory allocate for headroom unit

num_of_units – (Optional). How many units to allocate for headroom unit

autoscale_down – (Optional). Setting for scale down actions

evaluation_periods – (Optional). How many evaluation periods should accumulate before a scale down action takes place

kubernetes_integration {
    api_server = "https://master.addr"
    token      = "secret"

    autoscale_is_enabled = true
    autoscale_cooldown   = 300

    autoscale_headroom {
      cpu_per_unit    = 10
      memory_per_unit = 10
      num_of_units    = 10
    }
    autoscale_down {
      evaluation_periods = 5
    }
  }

EC2 Container Service (ECS)

ec2_container_service_integration – (Optional). Describes the EC2 Container Service integration definitions.

cluster_name – (Optional). EC2 Container Service cluster name

autoscale_is_enabled – (Optional). EC2 Container autoscaling state

autoscale_cooldown – (Optional). Cooldown period between scaling actions

autoscale_headroom – (Optional). headroom for the cluster

cpu_per_unit – (Optional). Cpu units for compute

memory_per_unit – (Optional). RAM units for compute

num_of_unit – (Optional). Amount of units for compute

autoscale_down – (Optional). Enabling scale down

evaluation_periods – (optional). Amount of cooldown evaluation periods for scale down

ec2_container_service_integration {
cluster_name = "foo"
autoscale_is_enabled = true
 autoscale_cooldown = 300
 autoscale_headroom {
cpu_per_unit = 8
memory_per_unit = 8
 num_of_units = 10
 }
autoscale_down{ 
evaluation_periods = 2
}

Code Deploy

codedeploy_integration – (Optional). Describes the Code Deploy integration definitions.

cleanup_on_failure – (Optional). Cleanup automatically after a failed deploy.

terminate_instance_on_failure – (Optional). Terminate the instance automatically after a failed deploy.

deployment_groups – (Optional). Specify the deployment groups details

application_name – (Optional). The application name

deployment_group_name – (Optional). The deployment group name.

codedeploy_integration {
    cleanup_on_failure = true
    terminate_instance_on_failure = true

    deployment_groups = [
      {
        application_name = "foo"
        deployment_group_name = "bar"
      },
      {
        application_name  = "alice"
        deployment_group_name = "bob"
      },
    ]
  }

Nomad Integration

nomad_integration – (Optional). Describes the Nomad integration definitions.

api_server – (Optional). URL for Nomad API Server

acl_token – (Optional). Nomad ACL Token

autoscale_is_enabled – (Optional). Enabling the k8s auto-scaler functionality. for more information please see: Nomad auto-scaler

autoscale_cooldown – How long should the scaling wait after the last scale action before initiating addition scaling action

autoscale_headroom – (Optional). An option to set compute reserve for the cluster

cpu_per_unit – (Optional). How much CPU (MHz) to allocate for headroom unit

memory_per_unit – (Optional). How much Memory allocate for headroom unit

num_of_units – (Optional). How many units of headroom to allocate

autoscale_down – (Optional). Settings for scale down actions

evaluation_periods – (Optional). How many evaluation periods should accumulate before a scale down action takes place

autoscale_constraints  – (Optional). Constraints that apply to the Nomad Clients.

nomad_integration {

    master_host = "https://master.addr"
    master_port = 4646
    acl_token = "someTokenHere"
    autoscale_is_enabled = true
    autoscale_cooldown   = 300

    autoscale_headroom {
      cpu_per_unit    = 1000
      memory_per_unit = 2000
      num_of_units    = 1
    }

    autoscale_down {
      evaluation_periods = 5
    }

    autoscale_constraints = [
      {
        key   = "attr.kernel.name"
        value = "linux"
      }
    ]
  }