Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add allowed_instance_types to instance_requirements #267

Merged
merged 3 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,19 +225,45 @@ Note: the default behavior of the module is to create an autoscaling group and l

- [Complete](https://github.com/terraform-aws-modules/terraform-aws-autoscaling/tree/master/examples/complete) - Creates several variations of resources for autoscaling groups and launch templates.

## Contributing
bryantbiggs marked this conversation as resolved.
Show resolved Hide resolved

When contributing a change to this module, it is important to verify that the minimum provider version of this module is compatible.

To test this you can temporarily pin the version of the `aws` provider to the minimum version.

```hcl
# versions.tf
terraform {
required_version = ">= 1.0"

required_providers {
aws = {
source = "hashicorp/aws"

# version = ">= 5.xyz"
# temporary pinning to minimum version
version = "5.xyz"

}
}
}
```

Then test the examples against the pinned version.

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

| 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.46 |

## Providers

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

## 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
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.46"
}
}
}