3 ms·
A couple of years ago I started down the Pulumi path, but what was unclear at the time is that there are two phases of a pulumi run. The first is on constructi
by rswail 6y ago
A couple of years ago I started down the Pulumi path, but what was unclear at the time is that there are two phases of a pulumi run.
The first is on constructing the DAG of resources, the second is using that DAG to orchestrate the changes from the previous state.
The problem I had is that values that are only available in the second phase (eg a subnet ID) can't be accessed in the first phase directly. The subnet's ID is accessed via "my_subnet.id" but it's actually effectively a future.
You can't write something like "if my_subnet.id == "1234" (this is an arbitrary example), but effectively a reference to a resource's attributes is only available on the "right hand side" of an expression, and pretty much as a simple assignment only.
To use the value of an attribute, you essentially need to access the value in the second phase of the pulumi process, and to do that (at the time) involved essentially pushing through source code to be "eval"ed on the "other side".
I'll be interested to see what's changed :)