joneshf / terraform-provider-openwrt

A Terraform provider for OpenWrt using LuCI's JSON-RPC API
https://registry.terraform.io/providers/joneshf/openwrt
Mozilla Public License 2.0
33 stars 8 forks source link

Mandatory `id` blocks pulumi-openwrt wrapper #136

Open pcuci opened 1 year ago

pcuci commented 1 year ago

Hi @joneshf - thanks for creating this provider!

I'm trying to wrap your project with pulumi (so I can use it in my home lab stack), but am running into an issue due to the mandatory id field for LuCI's RPC calls

Am I understanding correctly that the id gets populated right after creating the section in uci? re:

https://github.com/joneshf/terraform-provider-openwrt/blob/552dbb4ca0eb4767f0b72e6139a8baa9c446fb01/openwrt/internal/lucirpcglue/resource.go#L100

In pulumi, this blows up with (see this example:

  openwrt:index:DhcpHost (testing):
    error: problem getting dhcp. section: could not find section dhcp.

However, the equivalent in Terraform native, seems to work fine, as in this example

... and I believe this is because Pulumi wants to first refresh the state of the world before it creates the resource, whereas in your provider no such pre-step happens(?)

A possible fix would require the LuCI id field to be made optional for Read operations(?) Is this something you've considered?

I'll detail more debug attempts in: https://github.com/deposition-cloud/pulumi-openwrt/issues/1