Is it possible to detect if an action was taken in...
# general
r
Is it possible to detect if an action was taken in an output apply? i.e. create, update
a
you mean like
Copy code
// pseudo code
const resource1 = new pulumi.resource()
resource.apply(val => {
   const resource2 = new pulumi.resource()
})
and see if resource 2 gets updated?
Because I have noticed that if I create resource inside of an apply it doesn't show up until the update is actually run. IE, preview doesn't show anything
which I think make sense because it wouldn't know the value of the output until it is actually run
r
No. I know you can’t create resources inside an apply. What I am looking to do is perform a validation inside of an apply something like this:
Copy code
resource.apply(val => {
  if (val.wasCreate() || val.wasUpdate()) {
     validate(val)
  }
})
As it is now, the function in apply always runs.
a
oh that's interesting. I see what you're getting at. I have never tried something like that. what is the downside of validating even if the resource wasn't updated?
Sorry I don't have a good answer. really just curious 😄