Trouble updating state ( I may be trying to do something that I'm not supposed to)

Hi there!

I have built a custom TF provider that hits an API endpoint and requests an x509 certificate. This all works fine as is however I want to be able to renew this certificate without revoking the existing one.

What I am doing now is making a change to one of the input variables of the defined resource to trigger the update. In the “updateResource” function it simply calls the “createResource” function to request a new certificate using the same input variables.

This is all working fine but TF is saving the state of the original certificate and not the new one.

I’m receiving this warning in the debug output.

Provider "provider[\"github.comcast.com/platform-services/xpki\"]" produced an unexpected new value for xpki_certificate.certificate, but we are tolerating it because it is using the legacy plugin SDK.
    The following problems may be the cause of any confusing errors from downstream operations:
      - .id: was cty.StringVal("0025ed350df2cdaecd6f8c1fd48e3d29efac3e92"), but now cty.StringVal("df18320c7319f43748564046e75442b7b5e8c6e5")
      - .timestamp: was cty.NumberIntVal(1.636426773996e+12), but now cty.NumberIntVal(1.63642683877e+12)

How can I achieve what I’m after here? Thanks!