-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
provider/aws: Change ELB access_logs to list type #5065
provider/aws: Change ELB access_logs to list type #5065
Conversation
Thanks for this, @tpounds! It seems like you're primarily interested in this because Terraform doesn't do well at rendering diffs for sets. If this change is motivated entirely by diff readability, do you think we should instead try to find a better way for Terraform to present set diffs? For example, Terraform could, in theory, detect the
The intent here is to indicate that the set contained two items and one of them is unchanged while the other has been replaced by a new item. Lists could be treated in the same way, since in that case too the indices are not really important. The relative ordering of the items is the main interesting thing in a List diff, so I think you'd just order the items by their prefix and then process the list in a similar way to how you'd diff lines of source code. Of course changing the diff rendering is a more intense Terraform change, but it'd have the benefit of fixing the sub-optimal rendering across all resources. What do you think? I'm really just thinking aloud here rather than suggesting that you need to implement this alternative, but thought it was worth discussing whether there's a more general fix we can apply . |
@apparentlymart Yes. My change here and in #5065 is primarily motivated around
I think it would be great to think about a longer term solution to improving diff readability for collections. This discussion sort of applies in this situation but mostly because Terraform's schema doesn't have a way to define a single structured type (e.g. Type: TypeStruct). The hack is to put this into a list/set and restrict the size to 1. 😞
Personally, I really like the side-by-side diff comparison since it makes it a lot easier to scan changes line by line at quick glance. I think this starts to get trickier for anything more complex than standard collections of primitive types. I suspect this will start to get kind of messy for anything non-trivial.
I agree. It would be kind of neat to preserve the ordering of the list with side-by-side views and show gaps where items were added or removed.
Agreed but I don't think it's minor surgery. 😄
I think improving the diff capabilities would be awesome. It's probably worthwhile opening a separate design issue to discuss ideas in more detail and/or solicit feedback from the community. |
Oh, I totally missed that this is one of those "list of zero or one items" scenarios. In that case, I agree that a list makes more sense than a set because it's clearer to present it as the user having changed the zeroth item rather than adding and removing an item. But I will take my diff suggestion and make a separate issue for it anyway. 😀 |
@phinze Any feedback on this pull request? |
There can only be a single access_log configuration per load balancer so choosing to use a list over a set is only relevant when comparing changes during a plan. A list makes it much easier to compare updates since the index is stable (0 vs. computed hash).
Just noticed this pull request is still open. Anything else I should address to get this merged? |
Hi @tpounds, apologies for not picking this up around the time of #5066 - thanks for the PR. The test run looks as follows:
|
provider/aws: Change ELB access_logs to list type
I'm going to lock this issue 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 similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Changes the access_logs type from set to list to makes it easier to compare updates when executing a plan.