Title
#general
j

Jimmy

04/19/2022, 2:20 AM
Hi team, Regarding to issue https://github.com/infracost/infracost/issues/421, I would like to know the usage file format of google_compute_address/google_compute_global_address because it’s not quite clear in the doc. I want to use just one type of the IP address, how can I specify it in usage file. The current output shows all the cases:
├─ IP address (if used by standard VM)                                                    730  hours                  $2.92 
 ├─ IP address (if used by preemptible VM)                                                 730  hours                  $1.46 
 └─ IP address (if unused)                                                                 730  hours                  $0.00
Ali (Infracost)

Ali (Infracost)

04/19/2022, 6:22 AM
Hi @Jimmy - great question! In the reference usage-file we don’t have that resource as we didn’t think of that edge-case when defining that resource’s pricing. This is the schema that’s used to define that’s resource’s prices, we’d need to add a string address_type param, similar to something like this, so users can define that in the usage-file. Plz let us know if this is something you’d like to work on and the team’ll be happy to help
j

Jimmy

04/19/2022, 6:58 AM
yes, that will help. We’d like to show the planned cost based on a certain situation to help the users get a basic understanding of their cost. Although the use case of IP address can change dynamically, it will be better considered in runtime cost.
Vadim (Infracost)

Vadim (Infracost)

04/19/2022, 1:47 PM
Hey @Jimmy! If Ail's proposed solution works for your case, are you willing to make the change for the resource? We have a section in our contributing guide how to do it: https://github.com/infracost/infracost/blob/master/contributing/add_new_resource_guide.md#add-usage-based-cost-components.
2:09 PM
If not, no worries 🙂 I created a GH issue, so you can follow the progress there or if you have more details/suggestion, please add them in comments https://github.com/infracost/infracost/issues/1572
8:47 PM
FYI, I went ahead and added the param. Could you please take a look and tell if this works for you? https://github.com/infracost/infracost/pull/1573/files#diff-37ce8c61de6c3efc76d2b3e67cb04e69193f112c62466f654fb429186aa486ecR13
Ali (Infracost)

Ali (Infracost)

04/19/2022, 10:02 PM
That’s awesome Vadim! I wonder if we should put the type in brackets: IP address (standard VM) or IP address (preemptible VM) or IP address (unused)
Vadim (Infracost)

Vadim (Infracost)

04/20/2022, 9:37 AM
Sure thing, I'll update it 👍
4:04 PM
@Jimmy Just a heads-up: the change is merged to master and will go live with the next release in a week or two. Thank you for the suggestion, keep it coming! 🙂