green-morning-1318
03/02/2020, 11:41 PMinstance, _ := ec2.GetInstance(ctx, "lookup", pulumi.ID("my-instance-id"), nil)
where I know the instance ID is correct (I’ve copied it from the UI and when I do a ec2.GetInstances()
it is one of the returned values)
The result when running pulumi up
is
panic: reflect: call of reflect.Value.Type on zero Value
goroutine 23 [running]:
reflect.Value.Type(0x0, 0x0, 0x0, 0x0, 0x0)
/usr/local/Cellar/go/1.14/libexec/src/reflect/value.go:1872 +0x183
<http://github.com/pulumi/pulumi/sdk/go/pulumi.marshalInputs(0x23a7900|github.com/pulumi/pulumi/sdk/go/pulumi.marshalInputs(0x23a7900>, 0x0, 0x19, 0x0, 0xc0001418c0, 0xc0002b2280, 0x35, 0x0, 0x0)
/Users/lstigter/go/pkg/mod/github.com/pulumi/pulumi@v1.11.1/sdk/go/pulumi/rpc.go:76 +0x18a
<http://github.com/pulumi/pulumi/sdk/go/pulumi.(*Context).prepareResourceInputs(0xc0002ea000|github.com/pulumi/pulumi/sdk/go/pulumi.(*Context).prepareResourceInputs(0xc0002ea000>, 0x23a7900, 0x0, 0x22a3581, 0x19, 0xc0001418c0, 0xc0002765c0, 0x0, 0x0, 0x0)
/Users/lstigter/go/pkg/mod/github.com/pulumi/pulumi@v1.11.1/sdk/go/pulumi/context.go:710 +0x23a
<http://github.com/pulumi/pulumi/sdk/go/pulumi.(*Context).ReadResource.func1(0xc0002765c0|github.com/pulumi/pulumi/sdk/go/pulumi.(*Context).ReadResource.func1(0xc0002765c0>, 0xc0002ea000, 0x23b9080, 0x2396460, 0x23a7900, 0x0, 0x22a3581, 0x19, 0xc0001418c0, 0x22936bb, ...)
/Users/lstigter/go/pkg/mod/github.com/pulumi/pulumi@v1.11.1/sdk/go/pulumi/context.go:315 +0x252
created by <http://github.com/pulumi/pulumi/sdk/go/pulumi.(*Context).ReadResource|github.com/pulumi/pulumi/sdk/go/pulumi.(*Context).ReadResource>
/Users/lstigter/go/pkg/mod/github.com/pulumi/pulumi@v1.11.1/sdk/go/pulumi/context.go:298 +0x3b1
I’m using Pulumi v1.11.1 with the AWS Provider v1.23.0
Any thoughts on what might be wrong, or thoughts on how to debug further are appreciated 😇lemon-agent-27707
03/02/2020, 11:45 PMgreen-morning-1318
03/02/2020, 11:46 PMlemon-agent-27707
03/02/2020, 11:51 PM&ec2.GetInstanceArgs{}
instead of nil
for that fourth parametergreen-morning-1318
03/02/2020, 11:53 PMlemon-agent-27707
03/03/2020, 1:59 AMpulumi.Apply
to execute a callback on the raw values. Some docs on this here:
https://www.pulumi.com/docs/intro/concepts/programming-model/#apply
A common pattern we use if unit testing functionality is to pass the raw values back into channels. There's an example of that here:
https://github.com/pulumi/pulumi/blob/master/sdk/go/pulumi/types_test.go#L320-L349
Does that help? Let me know if you have more questions.green-morning-1318
03/03/2020, 2:16 AMApply
was exactly what I was looking for. Thanks for the help 🙌