https://infracost.io logo
#contributors
Title
# contributors
f

faint-mouse-18716

03/28/2023, 12:07 AM
Hi! I’ve found a minor annoyance related to the
azurerm_lb_rule
resource. If the rule is attached to an
azurerm_lb
load balancer with the
Basic
SKU this is a free resource, but if it’s attached to a
Standard
SKU it has an associated cost. The original issue requesting support for these load balancers called this out, but it looks like it was missed in the the initial implementation. 🧵
I took a quick look at the `lb_rule`’s cost component and it seems like this would be pretty easy to implement. Basically: 1. Implement a
lookupParentSku()
helper similar to the lookupRegion helper 2. Set the
skuName
field in the ProductFilter for the
lb_rule
to match the parent load balancer’s SKU The piece I’m not familiar with is how to add a new resource price like this to the cloud pricing backend. The dumb answer is to just set the UnitMultiplier for the lb_rule to zero, but I suspect that’s not the correct answer 😁. I’m also not clear how a sometimes-free resource would relate to the “free resources” lists.
Is there anything I’m missing here that makes this harder than I’m imagining? I can file a Github issue with these details if you’d like. I’m happy to work on an implementation myself, unless this is either super easy for you all to do or super hard for me to do.
c

crooked-daybreak-55253

03/28/2023, 11:42 AM
Hey Jesse thanks for pointing this out. Yes it looks like an easy fix. I’ll jump on it now because we’re going to release a new version today or tomorrow and I’d like to get it in that.
If you’re up for it, it would be great if you could review (or suggest) appropriate test cases.
f

faint-mouse-18716

03/28/2023, 12:25 PM
Great, thanks! I will give these test cases a review once I get to a computer
Here’s a diff that will get you close in test cases. I generated these goldens by hand so I don’t think they’re perfect, but this will get you super close on the test cases
c

crooked-daybreak-55253

03/28/2023, 3:57 PM
f

faint-mouse-18716

03/28/2023, 6:14 PM
Nice!! This looks good to me
Thanks for the fast turnaround!
27 Views