Closed trondhindenes closed 1 week ago
Hi @trondhindenes. Thanks for reporting an issue.
I think you need to import as
var testNamespace = new Rancher2.Namespace($"testNamespace-{managedCluster}", new Rancher2.NamespaceArgs
{
Name = "testnamespace",
ProjectId = myprojectId,
},
new CustomResourceOptions
{
Provider = rancherProvider,
ImportId = $"{myprojectId}.testNamespace" // Maybe $"{myprojectId}.testNamespace-{managedCluster}"
}
);
The format for import is <project_id>.<namespaces_id>
.
oh, thanks. Let me test that right away!
hm this is trickier than I thought since ImportId expects a string and not an input, and myprojectId is an output.
I ended up wrapping the entire resource in an Apply statement to resolve project ID, but that's outside the scope of this issue I guess. The import works perfectly fine now. I would argue that the error message is a bit misleading tho.
btw how would I know what the format of the import would be? If I remove the importId and run a preview, when looking at the produced json there's no indication that I'd need the project id. Just trying to figure out how I can "see" what to do.
I looked the import section here: https://www.pulumi.com/registry/packages/rancher2/api-docs/namespace/#import. I agree that the error message wasn't great.
Thanks!
Describe what happened
I'm trying to import an existing namespace, but I'm getting an error "Cluster Client: cluster ID is nil". That doesn't make sense to me, there's nowehre either in the resource or on the provider to set a cluster ID as far as I can see.
Sample program
Log output
Affected Resource(s)
No response
Output of
pulumi about
Additional context
No response
Contributing
Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).