Hi folks, is there a way to programmatically exclu...
# typescript
f
Hi folks, is there a way to programmatically exclude some resource outputs that will be stored in stack? For example I'd like to avoid storing bcryptHash/result secrets from RandomPassword resource inside the stack when I generate it only based on certain conditional. I quickly checked the options that
registerStackTransformation
gives but that basically works only on the inputs part rather than what is saved after it's created to the stack - at least to my understanding as of now. Perhaps there is a better way of doing this altogether (generating a password resource on the fly without storing it in the stack and without writing helper functions)
l
If there's something that you don't want in the stack, then you shouldn't use a resource to do that work. You can generate random strings in other ways...
f
Hi, thanks for taking a minute. Well, yes and no. I can use other ways to generate password and not store it inside a resource but I'm passing that password to other resources that have to be created regardless of the way I generate them (and therefore store that value too) so I thought of applying the same 'pattern' on those.
l
Is your goal to have a value that can be accessed via a resource object but isn't available via state? Maybe you could make it available only via an accessor / method, rather than via a property. Then it won't become an output. Then you'll have the problem of where to store that value, or how to compute it from other stored properties.
However, the general answer is: Pulumi persists all its info in the state, so if you want Pulumi to persist it, it'll have to go into the state. You can choose to persist values in Pulumi programs yourself, and that will avoid having Pulumi persist them. And then the problem is no longer a Pulumi problem, it's a general programming problem.