ddelnano / terraform-provider-mikrotik

MIT License
131 stars 29 forks source link

Mark all optional fields as computed in PluginFramework implementation #189

Closed maksym-nazarenko closed 1 year ago

maksym-nazarenko commented 1 year ago

Due to the way the new Plugin Framework works, all configuration values with null value must remain this value, otherwise, during apply user will get this error:

When applying changes to ... provider produced an
        unexpected new value: .FIELD: was null, but now cty.StringVal("").

That is known behavior because of underlying RouterOS client implementation and the way of mapping from RouterOS model to Terraform model.

Here are the ways to solve this issue:

  1. Update mapping of zero values to Terraform model
  2. Mark all optional fields as Compouted: true so Plugin Framework accepts change to the field after terraform apply

Option 2 is easier at the moment and doesn't logic update which could potentially break something.