https://pulumi.com logo
#hackathon-03-19-2020
Title
# hackathon-03-19-2020
g

green-morning-1318

03/19/2020, 6:04 PM
Hi team, is there any way to debug / troubleshoot why my
pulumi up
command is “hanging”? It doesn’t look like anything is happening 😞
w

white-balloon-205

03/19/2020, 6:08 PM
What language is it in?
g

green-morning-1318

03/19/2020, 6:08 PM
Go
w

white-balloon-205

03/19/2020, 6:09 PM
Hmm - nothing comes to mind in particular - verbose logs likely helpful - what do so see in output?
g

green-morning-1318

03/19/2020, 6:24 PM
Hmm 🤔 I think I figured out what my problem is, and I have a sort of workaround but I’m not sure this is the best solution. I’m creating an API Gateway, using an API specification. To connect the gateway to the Lambda functions, I need to add an Integration. The integration needs the ID of the Resource and to do a LookupResource I need a raw string value of the API Gateway ID. To get that, I do
Copy code
c := make(chan string)
	gw.ID().ToStringOutput().ApplyString(func(id string) string {
		c <- id
		return id
	})

	restID := <-c
But during dry run, this won’t work because there is no ID yet and this is stops waiting for the channel. I think I can work around this by simply adding an if statement
Copy code
if !ctx.DryRun() {}
But I’m not sure that’s the correct option
any thoughts on this?
w

white-balloon-205

03/19/2020, 6:25 PM
Oh - yeah - managing your own concurrency could definitely lead to hangs.
The integration needs the ID of the Resource and to do a LookupResource I need a raw string value of the API Gateway ID.
Can you do the
LookupResource
inside an
.Apply
?
g

green-morning-1318

03/19/2020, 6:29 PM
I guess I could. I’d need to do a few lookups and make sure the data of the lookup will be available outside the Apply… let me try a few things 🙂
w

white-balloon-205

03/19/2020, 6:30 PM
The idea should be (schematically):
Copy code
gateway = new Gateway();

new Integrattion({
   resource: gateway.id.apply(gatewayId => getResource(gatewayId)),
})
g

green-morning-1318

03/19/2020, 7:22 PM
Works like a charm now 🙂 my apply function is a little big but it works like a well oiled machine. One service done, a few more to go before 5pm 😅
3 Views