https://pulumi.com logo
#getting-started
Title
# getting-started
i

important-lion-7565

12/21/2023, 1:18 AM
Hi, is there any way to run a function before command "pulumi up" starts it's planning phase but can still access output of resources?
l

little-cartoon-10569

12/21/2023, 2:32 AM
The resources mightn't have been created at that time, right?
But: no. Accessing the value of a resource property can be done only inside an
apply()
, which is a future function that is evaluated during engine execution. After planning, during execution.
A pattern that may help is to split your project into two. The resources that strictly need to be available can be in the first project, and can export the appropriate values as stack references. The resources that depend on those guaranteed-available resources can be in the second project, and use the stack references.
i

important-lion-7565

12/21/2023, 2:53 AM
Hey thanks, using apply() was the solution.