Given the following component resource https://gist.github.com/roderik/4d6a223f05623280d87b2ce16c870d2f i can easily scale up my PVC (by increasing resources.limits.storage) But scaling down can’t happen as this will throw an error. Is there a way to access the “current” state of this component resource so I can compare it and not downgrade storage?
l
little-cartoon-10569
03/16/2022, 10:02 PM
That should be done outside of Pulumi. You can call your cloud provider's SDK to get the current value synchronously, before Pulumi starts doing its thing (that is: don't do it inside the component resource, do it in index.ts or similar). Then pass it to where it needs to be and apply your logic.
Or, if you wanted to do it asynchronously, you could look it up inside the constructor, but that introduces more opportunity to fail during deployment.