Hi y’all! I’m trying to get the details of a speci...
# golang
Hi y’all! I’m trying to get the details of a specific EC2 instance, but I’m getting an error that I can’t explain 😞 The code that throws an error is:
Copy code
instance, _ := 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
it is one of the returned values) The result when running
pulumi up
Copy code
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 😇
Sorry you're hitting this rough edge. I believe this is the same issue as https://github.com/pulumi/pulumi-azure/issues/470 It was fixed by https://github.com/pulumi/pulumi/pull/4010 and will be shipped with our next CLI release on wednesday.
aha! that might be it 🤔 that’ll teach me to actually read other issues too, sorry 😳
so I’ll wait till Wednesday 😄 , thanks for the super quick response @lemon-agent-27707
@green-morning-1318 you should be able to work around this. You can provide something like
instead of
for that fourth parameter
🙌 1
that does work! thank you
@lemon-agent-27707 is there a way to convert the Pulumi types (like StringOutput or MapOutput) to their respective Go types? For example, I want to check the tags of resources to make sure that a certain tag is set and if it isn’t set perform an action.
@green-morning-1318 as these values are essentially futures/promises, you need to use
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.
Thanks! I’ll go try it out tonight 🙂
@lemon-agent-27707, forgot to update you sorry 😬 the
was exactly what I was looking for. Thanks for the help 🙌
👍 1