I've created several networks in a base project (w...
# general
I've created several networks in a base project (which contains the needed base structure). In another project I wanted to create the needed servers. Now I thought that I can export the network ID (pulumi.iD) in the base project and use it in the other one. But when I try to get the ID in the other project I can't create an IDOutput.
Copy code
subnetId := 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:
Copy code
ctx.Export(name, subnet.ID())
The exported ID is something like: 2545501- As such, it's truely a string. :)
Without seeing your code, you should be able to to omit the
and reference
directly as an Input to another resource.
It doesn't work. The method expects an IDInput and the Output can't be used:
Copy code
subnetId := 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.
I’m not familiar with the HCloud provider, but I could see where the
may not work with an Output for the parameter. Given that this is being retrieved via a stack reference, perhaps check out the new
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.)
After some tries I got a step further. But: As mentioned in my last post. The one is in Project base, the other is in another Project (not stack). Now It works with the ID as far it gets no issues with getting the ID but the urn isn't found. Which is in another project. What's the master plan? Do I have to have all things together in one Project? WIth diffrent stacks?
Can you share more details, perhaps more portions of your code? We’d love to help you find a solution.