Skip to content

Commit

Permalink
feat: Add allowed_instance_types to instance_requirements (#267)
Browse files Browse the repository at this point in the history
* feat: Add `allowed_instance_types` to `instance_requirements` (#265)

* Bump aws provider to >= 5.46 to cater for new `allowed_instance_types` parameter and for ALB module updates in examples

* fixup per reviewer comments
  • Loading branch information
baolsen authored May 28, 2024
1 parent 5b2d7bf commit 09d8e0f
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 11 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.32 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.45 |

## Providers

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

## 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.32 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.45 |

## Providers

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

## 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 @@ -509,14 +509,17 @@ module "instance_requirements" {
accelerator_manufacturers = []
accelerator_names = []
accelerator_types = []
# If you specify allowed_instance_types, you can't specify excluded_instance_types
# allowed_instance_types = ["m*"]

baseline_ebs_bandwidth_mbps = {
min = 400
max = 1600
}

burstable_performance = "excluded"
cpu_manufacturers = ["amazon-web-services", "amd", "intel"]
burstable_performance = "excluded"
cpu_manufacturers = ["amazon-web-services", "amd", "intel"]
# If you specify excluded_instance_types, you can't specify allowed_instance_types
excluded_instance_types = ["t*"]
instance_generations = ["current"]
local_storage_types = ["ssd", "hdd"]
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.32"
version = ">= 5.45"
}
}
}
7 changes: 4 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,9 @@ resource "aws_launch_template" "this" {
}
}

accelerator_types = try(instance_requirements.value.accelerator_types, [])
bare_metal = try(instance_requirements.value.bare_metal, null)
accelerator_types = try(instance_requirements.value.accelerator_types, [])
allowed_instance_types = try(instance_requirements.value.allowed_instance_types, null)
bare_metal = try(instance_requirements.value.bare_metal, null)

dynamic "baseline_ebs_bandwidth_mbps" {
for_each = try([instance_requirements.value.baseline_ebs_bandwidth_mbps], [])
Expand All @@ -191,7 +192,7 @@ 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, [])
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, [])
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.32"
version = ">= 5.45"
}
}
}

0 comments on commit 09d8e0f

Please sign in to comment.