Created
July 23, 2019 16:40
-
-
Save paranoidd/0ae2e4a1cf672bc0e5c708b85c00968c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data "aws_ami" "amazon_linux_ecs" { | |
most_recent = true | |
filter { | |
name = "name" | |
values = ["amzn2-ami-ecs-hvm-*-x86_64-ebs"] | |
} | |
filter { | |
name = "owner-alias" | |
values = ["amazon"] | |
} | |
owners = ["591542846629"] # AWS Account id | |
} | |
resource "spotinst_elastigroup_aws" "default" { | |
count = 1 | |
name = "ecs-spotinst-elastigroup" | |
product = "Linux/UNIX" | |
min_size = 3 | |
max_size = 5 | |
desired_capacity = 3 | |
capacity_unit = "instance" | |
region = "eu-west-1" | |
subnet_ids = ["sbn-my-own"] | |
image_id = "${data.aws_ami.amazon_linux_ecs.id}" | |
iam_instance_profile = "my-role-arn" | |
key_name = "aws_initialization_default" | |
security_groups = ["sg-my-group-id"] | |
user_data = "" | |
enable_monitoring = false | |
ebs_optimized = true | |
placement_tenancy = "default" | |
instance_types_ondemand = "r5.large" | |
instance_types_spot = ["r5.large", "r5a.large"] | |
instance_types_preferred_spot = ["r5.large"] | |
orientation = "balanced" | |
spot_percentage = 100 | |
fallback_to_ondemand = true | |
cpu_credits = "unlimited" | |
revert_to_spot { | |
perform_at = "always" | |
} | |
wait_for_capacity = 5 | |
wait_for_capacity_timeout = 300 | |
scaling_strategy = { | |
terminate_at_end_of_billing_hour = true | |
termination_policy = "default" | |
} | |
integration_ecs = { | |
cluster_name = "my-ecs-cluster" | |
autoscale_is_enabled = true | |
autoscale_is_auto_config = true | |
autoscale_cooldown = 300 | |
autoscale_scale_down_non_service_tasks = false | |
autoscale_attributes = [] | |
} | |
ebs_block_device = [{ | |
device_name = "/dev/xvda" | |
volume_type = "gp2" | |
volume_size = 10 | |
delete_on_termination = true | |
}] | |
tags = [] | |
lifecycle { | |
ignore_changes = [ | |
"desired_capacity", | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment