powerful-lighter-63321
04/09/2023, 5:26 AMsubnetId := stackRef.GetOutput(pulumi.String(name)).AsIDOutput()
It ends up with an:
panic: interface conversion: interface {} is string, not pulumi.ID
I've exported it this way:
ctx.Export(name, subnet.ID())
The exported ID is something like: 2545501-10.10.1.0/24 As such, it's truely a string. :)salmon-account-74572
04/10/2023, 2:07 PM.AsIDOutput()
and reference subnetId
directly as an Input to another resource.powerful-lighter-63321
04/11/2023, 6:27 AMsubnetId := stackRef.GetOutput(pulumi.String(name))
snet, err := hcloud.GetNetworkSubnet(ctx, ctx.Stack(), subnetId, nil)
It's related to the hcloud and I think if it should be as easy as you describe then there might be something wrong with the hcloud parameters. This would explain that even the examples for hcloud won't work without additional work of casting the Outputs in some other Types.salmon-account-74572
04/11/2023, 12:27 PMGetNetworkSubnet
may not work with an Output for the parameter. Given that this is being retrieved via a stack reference, perhaps check out the new GetOutputDetails
functionality, which is intended to make it easier to work with values retrieved via stack references: https://www.pulumi.com/blog/stack-reference-output-details/
(I haven’t used this functionality with Go yet, but I have done some work with it in TypeScript.)powerful-lighter-63321
04/12/2023, 7:11 AMsalmon-account-74572
04/12/2023, 11:41 AM