hi all, bit of a strange one not sure how to solve...
# general
i
hi all, bit of a strange one not sure how to solve this. i deploy a resource (k8s service type=ExternalName) and after it is deployed the tailscale operator in my k8s cluster will make some changes, but I need the value of that change (
.spec.externalName
) as an input to the next set of resources to deploy. something that might work is this, but i feel like there could be an easier solution / resource option I'm missing?
Copy code
const egress = new k8s.core.v1.Service(X)
const wait = new local.Command('sleep 5', { dependsOn: [egress] })
const egressUpdated = Service.get(id=X, { dependsOn: [wait] })
g
I've had a similar use-case in the past. I haven't found a more elegant solution in my scenario other than waiting a determinate amount of time. One minor optimisation could be to use the pulumi-time provider as you can add a "stateful" sleep to only run if a resource is first created or changed - Ref, rather than every run.
i
thanks Jason 🙂 i guess this is the way to do it! just fyi,
local.Command
will also not re-run if the create command doesn't change, ie. it would only sleep again if you change how long to sleep for
g
Ah also good to know, thanks. I did also see this in the Kubernetes provider which may help offload the wait logic - https://www.pulumi.com/registry/packages/kubernetes/installation-configuration/#pulumicomwaitfor but may need to consider what condition you can use?
l
I have one case of this too. I was able to refactor the resource into a base project. Exporting the relevant property and using it via a stack reference has side-stepped the problem in my case.