-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
remove empty [] to mapRoles object in aws-auth #606
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 empty [] to mapRoles object in aws-auth #606
Conversation
Simply having ${yamlencode(var.map_roles)} in mapRoles for aws-auth
creates a empty [] at the end after adding the default roles.
Changing it to be added only when its not empty
|
Are you really sure having
It doesn't look like that's what happening here as @dpiddockcmp mentioned.
👀👀👀👀 |
Yes it is, by itself. The issue here is which actually gets created as below, breaking the |
max-rocket-internet
left a comment
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.
Thanks @shanmugakarna 💜
|
You haven't update changelog! Very important! But in the interesting of getting stuff done, I'll merge now and update it myself |
|
@max-rocket-internet @dpiddockcmp Output See the behaviour here, a complex data type behaves differently inside and outside an if block, while a simple data type behaves as expected I think, we need to revert to |
|
You need to test the other use case of having something in the map: variable "empty_list_with_complex_type" {
type = list(object({
rolearn = string
username = string
groups = list(string)
}))
default = [{
rolearn = "arn:blah:blah"
username = "user"
groups = ["group"]
}]
}
output "empty_list_with_complex_type" {
value = <<EOF
Original
======
${yamlencode(var.empty_list_with_complex_type)}
Condition: ==
==========
%{if var.empty_list_with_complex_type == []}${yamlencode(var.empty_list_with_complex_type)}%{endif}
Condition: !=
=========
%{if var.empty_list_with_complex_type != []}${yamlencode(var.empty_list_with_complex_type)}%{endif}
EOF
}So Terraform is broken on this if type and complex Objects. Depending on comparison used you either always match or never match. Your usecase cannot currently be solved with this if block. And #611 will wipe out auth maps. |
…-modules#606)" This reverts commit 9de5b53.
|
Confirmed. This breaks Couldn't this work instead? Make the default value for Or, render the yaml fragment in a local, and only include the output if it's not |
|
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. |
Simply having ${yamlencode(var.map_roles)} in mapRoles for aws-auth creates a empty [] at the end after adding the default roles.
Changing it to be added only when its not empty
PR o'clock
Description
Please explain the changes you made here and link to any relevant issues.
Checklist