Are there any APIs that allow you to access and modify resources either by name, or by iterating through all resources? Use case: I’d like to add a “tag” to everything in a stack without having to go add it to the properties every single place I instantiate a resource.
Is this kind of “metaprogramming” supported, in general? I can’t find it in the API docs but maybe I’m missing something.
01/23/2019, 5:13 PM
This isn't quite possible today. One core challenge with this is that you have to add the tags prior to creating the resources.
The closest thing to this we're currently tracking is https://github.com/pulumi/pulumi/issues/2068. I could imagine extending that to have a sort of global hook that gets called anytime a resource is being created and lets you run code to add tags or otherwise inspect/modify it before it actually gets created?
Definitely feel free to add to the issue above, or open new issue, on use cases here.