https://pulumi.com logo
#typescript
Title
# typescript
h

helpful-easter-62786

06/01/2022, 11:36 PM
👋 what’s the typescript equivalent of the CLI command?
Copy code
pulumi config set thing:setting <value>
p

prehistoric-london-9917

06/01/2022, 11:54 PM
Not sure it’s idiomatic, but you could look at `pulumi.runtime.setConfig`: https://www.pulumi.com/docs/reference/pkg/nodejs/pulumi/pulumi/runtime/#setConfig
h

helpful-easter-62786

06/02/2022, 3:40 PM
@prehistoric-london-9917, I think I have a bit of a chicken and egg problem. I’m spinning up an aws fargate service and aws loadbalancer. I then spin up a Hashicorp Vault Token resource, and that’s the resource that’s always failing because it needs that config value set. However the value needs to come from the result of the loadbalancer’s endpoint value. I programmed the token resource to be dependent on the loadbalancer resource and I also call pulumi.all().apply() on the loadbalancer resource and inside the apply I call setConfig(). However the invocation of the apply call isn’t happening until it’s too late. I may try and jam spinning up the token resource inside that apply but ugh…
r

red-match-15116

06/02/2022, 6:48 PM
@helpful-easter-62786 it kinda sounds like you might need two different stacks here, you could probably orchestrate them with automation api so it happens in a single invocation of a script. Or else the vault resource should just take the config setting directly from the load balancer endpoint output rather than relying on an external config setting.
If it's the vault provider that needs to config setting you might be able to set it directly in the provider object
p

prehistoric-london-9917

06/02/2022, 7:40 PM
@helpful-easter-62786 I had a similar problem with Pulumi thinking LB resources were ready when they weren’t all the way. This was discussed previously here, but I think the thread was cut off from the archive. To solve it, I used
ts-retry
and simply waited for the
getLoadBalancer
function to return a result. In my case, I was creating a Route 53 record, but you could also use it in your use case of starting up a Hashicorp Vault resource. Mine was also in an
.apply
based on a Kubernetes Ingress resource, but could just as easily be any other resource.
2 Views