-
Notifications
You must be signed in to change notification settings - Fork 991
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
Remove limit for taints in kubernetes_node_taint
resource
#2046
Conversation
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.
This PR does not address the issue. Yes, Terraform is not throwing an error message anymore. However, the kubernetes_node_taint
resource takes into account only the first taint in the list, the rest doesn't apply. As the result, we get diff with every plan run.
Another point here is that tests were not updated to validate changes. I would suggest here the TDD approach. The idea is you first write a test that reproduces an issue without changing the code. In short, the tests should fail at this point. Once you have that done, you make changes in the code and run tests again, if the issue is addressed, the tests will pass.
Tried the case where a user will add taints with the same key but different values. A panic is outputted but the tfstate still shows the applied config. tfconfig: provider "kubernetes" {
config_path = "~/.kube/config"
}
resource "kubernetes_node_taint" "tainttest" {
metadata {
name = "minikube"
}
taint {
key = "node-role.kubernetes.io/example"
value = "false"
effect = "NoSchedule"
}
taint {
key = "node-role.kubernetes.io/example"
value = "true"
effect = "NoSchedule"
}
} tfstate:
doing |
@BBBmau This is expected behaviour, you can't set multiple taints with the same key. We should add some validation here so that it fails on the plan instead of generating the error at apply time. |
The list type doesn't support validators so I've pushed some logic that does the validation in a custom diff. |
Now it will show on plan time:
|
Description
Fixes #2035
Removes the
MaxItems
line from the "taint" attribute. Should allow the ability of multiple taint blocks if desired.Release Note
Release note for CHANGELOG:
References
Community Note