anyone else ran into issues with pulumi-kafka reso...
# general
p
anyone else ran into issues with pulumi-kafka resource import? https://github.com/pulumi/pulumi-kafka/issues/208
f
I took a quick peek at your issue, and I noticed you call a method named
GetResourceImportId
, but I don't see such a method anywhere in the provider code or your example code. If that's a method you wrote, you should definitely include its code in your example so folk can figure out what's going on
Speaking of adding more to your example, I strongly recommend you share the entire body of the
kafka.NewUserScramCredential
call (redacting where appropriate), as Pulumi imports are very reliant on every attribute you pass to these methods. I also don't see any
CustomResourceOptions
type being passed to this call, which you likely would need for importing purposes; however, all my experience with Pulumi is in C#, and this looks like Go (though I can't really tell as you didn't specify any syntax highlighting in your issue's markdown), so I could be mistaken there
Finally, having taken a quick peek at the provider, it's possible that including the
|SCRAM-SHA-256
in the ID could be causing problems. The Pulumi Kafka provider doesn't seem to include the Scram mechanism as part of the resource ID, so when it connects to Kafka and enumerates users, it may not be finding a user due to that. I don't know much at all about this, but it's worth a shot, at least!
p
GetResourceImportId
, but I don't see such a method anywhere in the provider code or your example code. If that's a method you wrote, you should definitely include its code in your example so folk can figure out what's going on
i changed the example. You can assume it is just the
resource_import_id
in the config
CustomResourceOptions
type being
not sure what u mean
share the entire body of the
kafka.NewUserScramCredential
not exactly sure what u mean. That's the entire body. Maybe you are referring to the varadic parameter options...?
it's possible that including the
|SCRAM-SHA-256
in the ID could be causing problems
we already tried without that and a few other combinations • username • username|SCRAM-SHA-256 • username|SCRAM-SHA-256|4096
🙏 anyone else have ideas?
s
@prehistoric-house-26852 Are you using Confluent by any chance?
p
nah just normal Kafka. I suspect it's the underlying TF provider does not support import of SCRAM_credential
s
Yeah, looking at the upstream provider, it's community-maintained (mostly by a single individual it seems), and the scram user resource, while in the README, is not in the provider docs on the TF registry: https://registry.terraform.io/providers/Mongey/kafka/latest/docs
p
yeah
i might have to do a "overriding" import which is not ideal
f
Regarding `CustomResourceOptions`: I can't tell from your example for whether you're providing any
CustomResourceOptions
, as they're called in C#. In Go, it looks like they're just extra options you provide after your `UserScramCredentialArgs`: https://www.pulumi.com/docs/concepts/options/import/ In C#, I'd be running an import like this:
Copy code
var resourceGroup = new ResourceGroup(name: "my-existing-group", args: new ResourceGroupArgs
{
    ResourceGroupName = "existing-resource-group-name-as-appears-in-azure",
    Location = "WestUS2"
},
options: new CustomResourceOptions
{
    ImportId = "/subscriptions/<subscription id>/resourceGroups/existing-resource-group-name-as-appears-in-azure"
});
In Go, it looks like you'd need to invoke
pulumi.Import(pulumi.ID("resource ID"))
, which I don't see in your example. It might need to be something like so:
Copy code
user, err := kafka.NewUserScramCredential(
        ctx,
        fmt.Sprintf("%s", args.Username),
        args.UserScramCredentialArgs,
        pulumi.Import(pulumi.ID("self_server_import_test_user_1"))
)