-
-
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
fix: cluster_iam_role_name logic bug #1417
fix: cluster_iam_role_name logic bug #1417
Conversation
TestsBasic example:
Added
|
name_prefix = var.cluster_iam_role_name != "" ? null : var.cluster_name | ||
name_prefix = var.cluster_iam_role_name == "" ? var.cluster_name : null |
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.
To me, both writing are similar.
-
name_prefix = var.cluster_iam_role_name != "" ? null : var.cluster_name
Ifvar.cluster_iam_role_name
is not empty, then returnnull
otherwise return the cluster name
=> This mean also: return null ifvar.cluster_iam_role_name
is empty (similar to 2) -
name_prefix = var.cluster_iam_role_name == "" ? var.cluster_name : null
Ifvar.cluster_iam_role_name
is empty , then return cluster name ornull
otherwise.
=> This mean also, return null ifvar.cluster_iam_role_name
is not empty (similar to 1).
Please see:
> "x" != "" ? null : "y"
tostring(null)
> "" != "" ? null : "y"
"y"
> "x" == "" ? "y" : null
tostring(null)
> "" == "" ? "y" : null
"y"
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.
they are same, but if you will take a look on name
conditional this is issue of real problem.
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.
name_prefix = var.cluster_iam_role_name != "" ? null : var.cluster_name
name = var.cluster_iam_role_name != "" ? var.cluster_iam_role_name : null
If we managed IAM resources (var.manage_cluster_iam_resources=true
) and var.cluster_iam_role_name
is defined, then use var.cluster_iam_role_name
as role name and don't use name_prefix
. Otherwise set the name_prefix
.
This is what I read. I'm probably missing something.
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.
Actually, the var.worker_role_name
behave the same. See https://github.com/terraform-aws-modules/terraform-aws-eks/blob/master/workers.tf#L448-L449
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.
ahhh, yup you are right, closing PR
@daroga0002 Thanks for working on this. But your tests results come from your PR or from the master branch ? |
from my fix, master branch has bad logic (conditional in |
Behaviour is good, it was my fault in interpreting code |
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
#1199 introduced some bug in logic of this resource. In both cases was same conditional. It started causing compatibility issues as
name_prefix
started to be replaced byname
, in result cluster wants to recreate as in #1382Checklist