I think Alex probably meant hanging this off its `...
# general
b
I think Alex probably meant hanging this off its
id
field, e.g.
Copy code
let vm = new aws.ec2.Instance(...);
vm.id.apply(_ => {
    // side-effectful code here
});
The apply body actually does not run during previews, because the value of the ID isn't yet known. This is definitely a bit of an abuse of
apply
, for sure, since it's meant to produce dataflow values that capture dependencies. And it will run on subsequent updates, not just the initial create, which for a lot of VM config scenarios won't work right. It can work for limited scenarios, though. Agree 100%, #1691 is going to be important for anything more sophisticated than "do this once during update."