Is there a way, inside of an inline program, to ac...
# automation-api
Is there a way, inside of an inline program, to access the “current” state of a resource (so the data i can see in the website)?
The data you can see within the cloud provider, or within your pulumi state?
Both of those should have separate static functions that you can call - if you want to retrieve the state of an existing resource there should be a pulumi static function to do so and return the result as an Output
To be more specific, there should be a function for that specific resource type. For instance, this is the function to get an existing AWS S3 Bucket
The above
function will query AWS and get the current state of a bucket that may or may not already exist in your stack. While this
function here will instead not query AWS at all, and will retrieve the state of an existing Bucket resource that already exists in your stack directly from your pulumi state. So it depends what you want to do. Btw none of this functionality is specific to automation API, this is just pulumi program functionality.
You can also access stack outputs from the stack outside of a pulumi program. So one possible pattern is: 1. read stack outputs from
function 2. curry them into the inline program 3. run your update