Cleaning up and deduplicating launch template related code #370
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In this PR I'm having a large cleanup of all code related to Launch Templates (LTs)! This is part of an effort to make everything related to LTs first class. Apart from simply being the direction AWS is going, LTs have some other distinct advantages:
mixed_instances_policy
ASG for multiple instance lifecycle options (e.g. spot and on-demand instances mixed)Reducing duplication
I am removing
local.workers_group_launch_template_defaults_defaults
as it's 96% the same aslocal.workers_group_defaults_defaults
. The reason for the initial separation was that when this was merged, LTs were new to both AWS and this module. So we made all LT related stuff separate. Now I think we merge them to reduce duplication. This also means removing variableworker_group_launch_template_tags
andlocal.workers_group_launch_template_defaults
.I have commented in
local.tf
to show the few options that apply only to LT based workers.Removing instance overrides in ASG
Currently we have in
aws_autoscaling_group.workers_launch_template
2 instanceoverride
andmixed_instances_policy
. I am removing these and just using the single instance type from the LT. The reason is that if you are wanting to have LT based worker groups, then having 2 instance types is just confusing. e.g. here. And if you want to run a mixed worker group, then 2 instance types is not nearly enough.I think after this is merged I will create a new PR for a worker group ASG that has 4-6 instance overrides and a
mixed_instances_policy
to match.Misc
service_linked_role_arn
option toaws_autoscaling_group.workers
Checklist
terraform fmt
andterraform validate
both work from the root andexamples/eks_test_fixture
directories (look in CI for an example)