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

Set full type name in `Configure` methods #98

Closed joneshf closed 1 year ago

joneshf commented 1 year ago

As mentioned in a previous change, the thing creating the Data Source or Resource it calls the Metadata method on doesn't actually hold onto the Data Source or Resource it just created. So, we can't set any data in that method and expect it to persist.

What we do instead, is set the data in the Configure method. This seems to persist for the lifecycle of the Data Source or Resource. Then, our logs work the way they're supposed to.

We also move the setting of the terraformType to the initialization of the respective Data Source or Resource function. It doesn't really make a whole lot of sense to wait to set that in the Configure method, since we already know at compile time what it's going to be.