Hiya! I’m developing my own little provider and it’s moving along quite well so far. I’m creating my resource with configured name of alice and when applied I can see it in the back-end created as it should. Now there’s other ways to modify API resources, so out of spite I edited the name to john in the back-end to test that terraform refresh picks up on the drift and modifies the state accordingly.
All is well, it is picking up the change, and I’m modifying the TF state to now say john, so the next terraform apply will change it back to alice.
However, a warning is produced and I’m not sure what I’m supposed to do about it.
[WARN] Provider “local.dev/tobias/foo” produced an unexpected new value for internal_thing.example during refresh.
- .name: was cty.StringVal(“alice”), but now cty.StringVal(“john”)
Am I as provider developer doing something wrong, or is this warning simply a reflection of that the name unexpectedly had changed in the back-end?
In the Read method of the resource I update my state model from the API client’s response and then use resp.State.Set to commit the changes to state, changing name to john in this case.
In the schema, name is not set as Computed since I don’t expect the provider to set a computed value.
So basically, is the warning something I as provider developer need to act on or is everything gravy?
Cheers, take care,
Tobias.