Skip to content

Commit

Permalink
feat: Support `max_spot_price_as_percentage_of_optimal_on_demand_pric…
Browse files Browse the repository at this point in the history
…e` (#276)
  • Loading branch information
magreenbaum authored Jul 7, 2024
1 parent e562239 commit 02251e3
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 26 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,13 @@ Note: the default behavior of the module is to create an autoscaling group and l
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.46 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.55 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.46 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.55 |

## Modules

Expand Down
4 changes: 2 additions & 2 deletions examples/complete/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ Note that this example may create resources which cost money. Run `terraform des
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.46 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.55 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.46 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.55 |

## Modules

Expand Down
7 changes: 5 additions & 2 deletions examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,9 @@ module "instance_requirements" {
override = [
{
instance_requirements = {
cpu_manufacturers = ["amd"]
local_storage_types = ["ssd"]
cpu_manufacturers = ["amd"]
local_storage_types = ["ssd"]
max_spot_price_as_percentage_of_optimal_on_demand_price = 60
memory_gib_per_vcpu = {
min = 2
max = 4
Expand Down Expand Up @@ -527,6 +528,8 @@ module "instance_requirements" {
instance_generations = ["current"]
local_storage_types = ["ssd", "hdd"]

max_spot_price_as_percentage_of_optimal_on_demand_price = 45

memory_gib_per_vcpu = {
min = 4
max = 16
Expand Down
2 changes: 1 addition & 1 deletion examples/complete/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.46"
version = ">= 5.55"
}
}
}
39 changes: 21 additions & 18 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,13 @@ resource "aws_launch_template" "this" {
}
}

burstable_performance = try(instance_requirements.value.burstable_performance, null)
cpu_manufacturers = try(instance_requirements.value.cpu_manufacturers, [])
excluded_instance_types = try(instance_requirements.value.excluded_instance_types, null)
instance_generations = try(instance_requirements.value.instance_generations, [])
local_storage = try(instance_requirements.value.local_storage, null)
local_storage_types = try(instance_requirements.value.local_storage_types, [])
burstable_performance = try(instance_requirements.value.burstable_performance, null)
cpu_manufacturers = try(instance_requirements.value.cpu_manufacturers, [])
excluded_instance_types = try(instance_requirements.value.excluded_instance_types, null)
instance_generations = try(instance_requirements.value.instance_generations, [])
local_storage = try(instance_requirements.value.local_storage, null)
local_storage_types = try(instance_requirements.value.local_storage_types, [])
max_spot_price_as_percentage_of_optimal_on_demand_price = try(instance_requirements.value.max_spot_price_as_percentage_of_optimal_on_demand_price, null)

dynamic "memory_gib_per_vcpu" {
for_each = try([instance_requirements.value.memory_gib_per_vcpu], [])
Expand Down Expand Up @@ -506,12 +507,13 @@ resource "aws_autoscaling_group" "this" {
}
}

burstable_performance = try(instance_requirements.value.burstable_performance, null)
cpu_manufacturers = try(instance_requirements.value.cpu_manufacturers, null)
excluded_instance_types = try(instance_requirements.value.excluded_instance_types, null)
instance_generations = try(instance_requirements.value.instance_generations, null)
local_storage = try(instance_requirements.value.local_storage, null)
local_storage_types = try(instance_requirements.value.local_storage_types, null)
burstable_performance = try(instance_requirements.value.burstable_performance, null)
cpu_manufacturers = try(instance_requirements.value.cpu_manufacturers, null)
excluded_instance_types = try(instance_requirements.value.excluded_instance_types, null)
instance_generations = try(instance_requirements.value.instance_generations, null)
local_storage = try(instance_requirements.value.local_storage, null)
local_storage_types = try(instance_requirements.value.local_storage_types, null)
max_spot_price_as_percentage_of_optimal_on_demand_price = try(instance_requirements.value.max_spot_price_as_percentage_of_optimal_on_demand_price, null)

dynamic "memory_gib_per_vcpu" {
for_each = try([instance_requirements.value.memory_gib_per_vcpu], [])
Expand Down Expand Up @@ -795,12 +797,13 @@ resource "aws_autoscaling_group" "idc" {
}
}

burstable_performance = try(instance_requirements.value.burstable_performance, null)
cpu_manufacturers = try(instance_requirements.value.cpu_manufacturers, null)
excluded_instance_types = try(instance_requirements.value.excluded_instance_types, null)
instance_generations = try(instance_requirements.value.instance_generations, null)
local_storage = try(instance_requirements.value.local_storage, null)
local_storage_types = try(instance_requirements.value.local_storage_types, null)
burstable_performance = try(instance_requirements.value.burstable_performance, null)
cpu_manufacturers = try(instance_requirements.value.cpu_manufacturers, null)
excluded_instance_types = try(instance_requirements.value.excluded_instance_types, null)
instance_generations = try(instance_requirements.value.instance_generations, null)
local_storage = try(instance_requirements.value.local_storage, null)
local_storage_types = try(instance_requirements.value.local_storage_types, null)
max_spot_price_as_percentage_of_optimal_on_demand_price = try(instance_requirements.value.max_spot_price_as_percentage_of_optimal_on_demand_price, null)

dynamic "memory_gib_per_vcpu" {
for_each = try([instance_requirements.value.memory_gib_per_vcpu], [])
Expand Down
2 changes: 1 addition & 1 deletion versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.46"
version = ">= 5.55"
}
}
}

0 comments on commit 02251e3

Please sign in to comment.