https://pulumi.com logo
#general
Title
# general
b

better-rainbow-14549

01/17/2019, 4:23 PM
is there any current way to be able to run a command when a resource is created, or just to be able to detect it. like even a horrible hack. i've found the git bits about the upcoming hooks
g

gorgeous-egg-16927

01/17/2019, 4:31 PM
In a pulumi program, you can write code that references the created resource, and the engine will only run that code once the resource is ready. e.g. https://github.com/pulumi/examples/blob/742def64a7490452df100652a71c306388f2d053/azure-ts-aks-mean/index.ts#L32 parses connection strings of a provisioned database.
b

better-rainbow-14549

01/17/2019, 4:37 PM
i was thinking something more like this
i basically need to execute some SQL when a resource is created
but ideally not each time pulumi does an update
g

gorgeous-egg-16927

01/17/2019, 4:39 PM
@white-balloon-205?
w

white-balloon-205

01/17/2019, 4:40 PM
https://github.com/pulumi/pulumi/issues/1691 is most directly tracking this. We're working on design for that now, and expecting to deliver a solution in the relative near term. You can technically accomplish this with dynamic providers already today, but it is not "simple". See https://github.com/pulumi/examples/pull/191.
b

better-rainbow-14549

01/17/2019, 4:40 PM
fantastic i'll have a look, cheers
exactly what i want, thanks
I couldn't get that working at all, i get an error "Resource.isInstance is not a function"