Closed DisgruntledCrayon closed 1 month ago
Testing revealed that my solution will work, but also that main.tf:194 will need to be changed to:
excluded_instance_types = try(instance_requirements.value.excluded_instance_types, null)
I came to the same conclusion, tested the proposed fix and it works. Will submit a PR shortly.
This issue has been resolved in version 7.5.0 :tada:
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Description
Please provide a clear and concise description of the issue you are encountering, and a reproduction of your configuration (see the
examples/*
directory for references that you can copy+paste and tailor to match your configs if you are unable to copy your exact configuration). The reproduction MUST be executable by runningterraform init && terraform apply
without any further changes.If your request is for a new feature, please use the
Feature request
template.⚠️ Note
Before you submit an issue, please perform the following first:
.terraform
directory (! ONLY if state is stored remotely, which hopefully you are following that best practice!):rm -rf .terraform/
terraform init
Versions
Module version [Required]: 7.4.1
Terraform version: v1.8.0
Provider version(s):
Reproduction Code [Required]
Steps to reproduce the behavior:
Expected behavior
When running
terraform apply
my expectation is that the list provided forinstance_requirements.allowed_instance_types
gets populated within the EC2 launch template when it get created.I expected it to be populated in the same way that it does when using
mixed_instances_policy.override
. However, when using this method, theallowed_instance_types
get added to the autoscaling group instead of the launch template (this is expected).Code like shown here:
Actual behavior
The launch template is created but the list provided for
instance_requirements.allowed_instance_types
doesn't get populated into the created launch template.Terminal Output Screenshot(s)
Additional context
I at the source and found that the problem is due to a missing line of code.
When looking at main.tf:769, I found that
allowed_instance_types
is utilized within theoverride
block. However, I would expect to find the same logic on main.tf:182, but don't. I have not verified this theory, yet, but adding the following line at main.tf:182 should remedy the issue I'm experiencing: