04/29/2021, 7:19 PM
I’m trying to understand if I’m doing something wrong or right in my code organization. I have a place in my code i’m creating an AWS Route Table. At that place in my code, I do a ctx.Export(“route_table_id”, rt.ID()) Later in a different function, I want to access this previously exported route table ID — so I started with using NewStackReference()… but it seems to fail an internal error / traceback when I try to use that ID. Is there a better way to “import” a resource that may be in the “current” stack?
panic: fatal: An assertion has failed

goroutine 169 [running]:
<*provider).Read|*provider).Read>(0xc000f0f920, 0xc00159eb40, 0x5b, 0x0, 0x0, 0x0, 0xc00050aea0, 0x4a7cc0d, 0x4, 0x0, ...)
	/private/tmp/pulumi-20210422-70582-1bpvlru/sdk/go/common/resource/plugin/provider_plugin.go:784 +0x1025
<*ReadStep).Apply(0xc00050af60|*ReadStep).Apply(0xc00050af60>, 0x1, 0x596f0d8, 0x23, 0xc0016bbe30, 0x3)
	/private/tmp/pulumi-20210422-70582-1bpvlru/pkg/resource/deploy/step.go:620 +0x103
<*stepExecutor).executeStep(0xc00072b700|*stepExecutor).executeStep(0xc00072b700>, 0x15, 0x5cda780, 0xc00050af60, 0x0, 0x100000005cca5a0)
	/private/tmp/pulumi-20210422-70582-1bpvlru/pkg/resource/deploy/step_executor.go:271 +0x209
<*stepExecutor).executeChain(0xc00072b700|*stepExecutor).executeChain(0xc00072b700>, 0x15, 0xc000622c20, 0x1, 0x1)
	/private/tmp/pulumi-20210422-70582-1bpvlru/pkg/resource/deploy/step_executor.go:221 +0xef
<*stepExecutor).worker.func1(0xc00072b700|*stepExecutor).worker.func1(0xc00072b700>, 0x15, 0xc000622c20, 0x1, 0x1, 0xc00159eba0)
	/private/tmp/pulumi-20210422-70582-1bpvlru/pkg/resource/deploy/step_executor.go:377 +0xc5
created by <*stepExecutor).worker|*stepExecutor).worker>
	/private/tmp/pulumi-20210422-70582-1bpvlru/pkg/resource/deploy/step_executor.go:374 +0x2c8


04/29/2021, 8:12 PM
I just had this exact stack trace, and in my case the issue was that I was referring to a non-existing terraform remote state. I don't know if this is your case but one thing's for sure, this stack trace did not help me at all.


04/29/2021, 8:51 PM
from my experience with python version of the tool
export doesn't mean you can use it anywhere you want
exported values can be accessed at the end, only at the end, after everything is done
if you need to pass a value from one operation to another, there are more complex steps to track
and we found them in from the examples in tutorial in python case, there wasn't a clear documentation


04/30/2021, 12:14 AM
Paul, what we do is create a state object that stores shared resources, and we pass that state object into different functions/modules. In other words, we don't use any Pulumi tooling for this, we just use features of the programming language.


04/30/2021, 2:02 PM
Can you open a git issue for
panic: fatal: An assertion has failed
You should not be getting that type of an error.