hey all o/ I'm developing my custom pulumi provide...
# general
e
hey all o/ I'm developing my custom pulumi provider for an internal service, and I can't get my Delete() function to be called. Do I need to set something up specifically for it to work? What am I missing?
this is what my delete function is looking like
Copy code
func (Environment) Delete(ctx context.Context, req infer.DeleteRequest[EnvironmentState]) error {
	config := infer.GetConfig[Config](ctx)
	client, err := client.New(client.Config{Token: config.Token, BaseURL: config.ApiUrl})
	if err != nil || client == nil {
		return fmt.Errorf("failed to create client: %w", err)
	}

	err = client.Environments().Delete(req.State.EnvironmentID)
	if err != nil {
		return fmt.Errorf("failed to delete environment: %w", err)
	}

	return nil
}
When I run
pulumi destroy
, it deletes the resources in the state only, never running that function nor calling the needed API for deletion.
how can I better debug this?
m
Hey @elegant-dawn-62745 If your delete function doesn't have the expected sig, then it won't be seen and won't be run. That is my guess on what's happening. Take a look at other go providers and see that you are matching the right method signature.
You an log the destroy to get more details:
Copy code
pulumi up --logtostderr --logflow -v=10 2> out.txt
e
Hey adam, thank you so much for your help! That was indeed the problem. I even double checked it and didn't notice I was missing the infer.DeleteResponse on return 🤦
🙌 1