-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Worker group tags #252
Worker group tags #252
Conversation
06af4b5
to
7b83330
Compare
Looks like I broke the build, trying to understand why and will fix it up, looks like it does not like having no elements defined and I greatly misunderstood Terraform. |
@max-rocket-internet looks like this may have been a fail, closing off until I can work something out, unless there are some TF hacks you know of many of the things I tried don't seem to work in 0.11 and may in 0.12, unless we had the users always defining the tags with empty arrays to match the worker group count which would not be ideal. |
… item does not exist for the worker group
@max-rocket-internet ok that involved ALOT of hair pulling but the best I could think of was that by default there is always one item in the list, then we use the matching item at the worker group index if we can find it otherwise we fallback to the first item in the list, this is not ideal but I tried a million other things and this was the only way I could get it working, any thoughts if this is an acceptable hack? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get this error when running with defaults (not adding any extra tags):
Error: Error running plan: 1 error(s) occurred:
* module.max_test.aws_autoscaling_group.workers: 1 error(s) occurred:
* module.max_test.aws_autoscaling_group.workers: concat: unexpected type list in list of type map in:
${concat(
list(
map("key", "Name", "value", "${aws_eks_cluster.this.name}-${lookup(var.worker_groups[count.index], "name", count.index)}-eks_asg", "propagate_at_launch", true),
map("key", "kubernetes.io/cluster/${aws_eks_cluster.this.name}", "value", "owned", "propagate_at_launch", true),
map("key", "k8s.io/cluster-autoscaler/${lookup(var.worker_groups[count.index], "autoscaling_enabled", local.workers_group_defaults["autoscaling_enabled"]) == 1 ? "enabled" : "disabled" }", "value", "true", "propagate_at_launch", false)
),
local.asg_tags,
list(var.worker_group_tags[length(var.worker_group_tags) > count.index ? count.index : "0"]))
}
@max-rocket-internet are you just running the examples? I can successfully run a Edit: OK I see it now :shakes-fist:, for some reason my examples run fine but spun up a blank TF file and can see the issue. For some reason and I don't understand why the default value for the variable and an explicitly set one behave differently, if I remove the wrapping |
… around the issue where list indexing does not work with a list of lists
Ok @max-rocket-internet turns out I ran into hashicorp/terraform#19033, this next idea works but changes things a little, instead of having an list of lists and relying on matching up to the index, I am using a map and using the worker groups name as the key. Now it is also slightly hacky in that by default there exists an item "default", and if you do not define tags for all your worker groups the user will need to ensure they add the default item back, but it does also allow you to easily set the tags for one group and default the rest like so it is a little more flexible.
My apologies with the brokenness, this PR has been a big learning experience for me as TF is relatively new to me and I probably jumped the gun a little bit, lesson learnt. |
OK great! I think this looks pretty tidy 🙂 Can you fix conflict and update the README using |
Thanks @max-rocket-internet should be good to go! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done @stefansedich! Thanks for the effort 😃
* master: Release v2.2.0 (terraform-aws-modules#270) Add optional permissions_boundary (terraform-aws-modules#265) Updating example IAM docs to include Launch Template actions (terraform-aws-modules#268) Added write_aws_auth_config option (terraform-aws-modules#228) Worker group tags (terraform-aws-modules#252) Adding the g3s.xlarge instance type ebs optimized mapping (terraform-aws-modules#258) Add enabled_metrics attributes to autoscaling_group (terraform-aws-modules#256) Use launch template defaults for launch template userdata (terraform-aws-modules#255) Enable create_before_destroy for ASG and enable force_delete to be configured (terraform-aws-modules#250)
I'm going to lock this pull request 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 related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
PR o'clock
Description
Adding ability to configure worker group ASG tags which resolves #89
Checklist
terraform fmt
andterraform validate
both work from the root andexamples/eks_test_fixture
directories (look in CI for an example)