Is there a way to use wildcards with modules that ...
# general
c
Is there a way to use wildcards with modules that contain usage_based resources? for instance, my resource_usage block previously looked like:
Copy code
module.developer_vms["eiq-dev-vm-developer-name-standard-1"].google_compute_instance.default[0]:
    monthly_hrs: 258.0 # Monthly number of hours the instance ran for.
about 20 times over. I tried using a wildcard to switch it to
Copy code
module.developer_vms[*].google_compute_instance.default[0]:
    monthly_hrs: 258.0 # Monthly number of hours the instance ran for.
but it failed to pick up the change and is ignoring the monthly_hrs setting
Failed to pick up the change as in, now all instances think they are running for the full amount of hours a month
w
Hey @colossal-television-87079! Would being able to set a default usage-value for a resource type help? Or would that mess-up the other ones you want to leave as running 730hrs?
Copy code
google_compute_instance:
  monthly_hrs: 258
Wildcard support for modules has an open PR from community member @polite-vr-31842 but it needs some tweaks before it can be merged. So I’m wondering which of these two PRs solves your use-case?
c
Wildcard support for modules would be the preferred approach for me because in this case I’m spinning up VMs I can predictably say should only be running during someones shift at work which I estimate out to around 258 hours. However we also run an sftp server at the moment that needs to be running 24/7 so a default wouldn’t necessarily make sense there.
w
great, plz subscribe to that pull request for updates. @little-author-61621 is the work on the module wildcard PR quite major or something we can knock-out in September?
@polite-vr-31842 I’m guessing you don’t have time to work on the module wildcard PR?
l
I think there’s a lot of edge-cases we need to account for for when module wildcards are used with resource wildcards. My guess is it would take us around day of engineering effort.
p
@white-airport-8778 Yes, I’m mostly busy with migration stuff whenever I find free time. On the other hand, I encountered many edge-cases when I was working on it and if we switch to using the usage schema structs that are defined in the new structure it would change the implementation of this feature as well.