Within a new native provider (based on the new pul...
# golang
p
Within a new native provider (based on the new pulumi-provider-boilerplate/golang). I've got the need to get access on the config. But within the functions I only have got a provider.Context. Has anybody an idea how to get the pulumi.Context and then the Config? I've got to get access to a token for the api I wanted to call.
func (MyResource) Delete(ctx p.Context, id string, input MyResourceArgs) error {
deleteMyResource(ctx, id)
Within this method, I've got to initialize the api-client. This needs the config values for the api, because I call another library which is needed to work. Or can I initialize it somewhere else except in the Create,Delete,... Methods? But I definitively need the secrets. As of now, I'm using environment variables to achive this. But I think they're better kept in the secrets, as a single source of truth.
e
You'll want to setup provider configuration, there's an example of that at https://github.com/pulumi/pulumi-go-provider/blob/main/examples/credentials/main.go
p
Thanks, I've found it and it works like a charm. At first there was an issue: If you're using it in a provider derived from the pulumi-provider-boilerplate you've got to implement "Version" and "pluginDownloadURL" in the Config as well. The python sdk complains about this missing properties, if I haven't implemented them. But after that it works great. 😉