Terraform custom provider Read responsibility


I have a private provider, and I am not clear on the responsibility of a Resource Read function. The common case I have is:

  • The resource configuration has external input in addition to that of Terraform source
  • I typically hash the external input into a computed member named “hash”
  • In the Read function, if I see a difference in “hash”, I return ID “” to cause Terraform to process the change

It feels wrong, because what I want to do is provide the current hash in Read. But it ends up reaching here:

fmt.Fprintf(&buf, "[WARN] Provider %q produced an unexpected new value for %s during refresh.", n.ResolvedProvider.Provider.String(), absAddr)

Is it correct for Read to return an empty ID if its external input has changed?