I'm trying to debug something with a Pulumi provid...
# typescript
b
I'm trying to debug something with a Pulumi provider, and could do with some pointers on how to get started. It's the proxmox provider, which is available here, and is using the Pulumi Terraform bridge to bridge across the Terraform provider from here. My issue is that when I define a VM with some disks under
disks
, pulumi sees an
update
as being necessary as a result of a diff every time I run
pulumi up
, which seems to be that it thinks the
speed
values need setting. I've replicated the same VM in the underlying Terraform provider, and didn't see constant diffs, so this is something about either how the bridge is working or how it has been used for that provider.
disks
is particularly interesting because it doesn't exist as a property on the underlying Tf provider. In HCL, a VM can have multiple independent
disk {}
blocks, but of course that is invalid in JSON/TypeScript etc, so something (I assume the bridge rather than custom code in this use of it, but maybe i've just missed where it is being done) is instead defining them all as an array of objects under
disks
. Further to that, if I set any of those
speed
values to anything non-zero the diff goes away (but I don't want to be forced to set them, because I want the value to be 'unlimited', which is what
0
means), but if I try and update any of them after setting any value to non-zero (whether I update the same one again to a new non-zero value or a different one from zero->non-zero), the update is not seen by pulumi, it thinks there is nothing to do. And if I change a different value that it does see (e.g. disk
size
) it will see an update and apply the
size
change, but not the
speed
changes. Again, this bug is not present in the underlying Terraform provider. I've no real idea where to even begin debugging this, so if anyone has and pointers that would be amazing.
a
Hey, which version of the bridge are you using? You might want to update to the latest version. We've also got a bridge feature we've been working on which isn't enabled by default but can help with some of these Diff issues
EnableAccurateBridgePreview
- try enabling that in the
resources.go
file, here's an example. Another thing to note is that a big difference between TF and pulumi is that TF refreshes by default. When testing the issue in TF, try running with
-refresh=false
- does the issue still not repro? If that all fails, you can get some additional logs on the interactions by setting
PULUMI_DEBUG_GRPC=grpc.json
and then running the pulumi operation. That should include the GRPC interactions between the pulumi engine and the provider so could shed some light on the issue.
b
I don't know which bridge version it's using offhand, it's someone else's provider. We were actually expecting to have to roll our own, but then when we tried to create the bridge the initialiser for that seemed to be able to identify that there was already an existing provider bridging the same Tf source, so just pointed us to that. We were actually having trouble trying to work out how to prevent that from happening, so that we could create our own bridge if we found issues with the existing one like it using an out-of-date bridge release or similar. Do you know how we can do that? I'll do the test with no refresh on the Tf side though
a
The easiest way to bridge a terraform provider is to use this method: https://www.pulumi.com/registry/packages/terraform-provider/ It allows for generating the SDKs locally so you don't need to bother with the publishing etc. It doesn't allow much customisation however. The pulumi-proxmox provider seems maintained, however - it is using a recent version of the bridge, so you might want to open an issue there. If you'd like to bridge the TF provider yourself and have the full customization options available, then the tool to use is https://github.com/pulumi/pulumi-tf-provider-boilerplate > but then when we tried to create the bridge the initialiser for that seemed to be able to identify that there was already an existing provider bridging the same Tf source Which initializer were you using? What error did it give?
k
Hi @adorable-house-61348, I work with @bland-monitor-37952 and some initial discovery work with Pulumi. I believed what Dan described:
but then when we tried to create the bridge the initialiser for that seemed to be able to identify that there was already an existing provider bridging the same Tf source, so just pointed us to that
was what happened to me, but having run the command again
pulumi package add terraform-provider bpg/proxmox
it is giving me the machine-created implementation. If to your knowledge there is no lookup of an existing bridge maintained elsewhere when running a command like this, I was almost certainly just mistaken.
b
I have already opened an issue on the existing provider btw, but I thought I would also try and debug to give more context/provide a better bug report as well