I’m creating a resource in my provider that goes through several statuses: creating
on the first Create API call, then some minutes later, it transitions into succeeded
or failed
.
I’m thinking what’s the best way to manage this kind of resource. Should I save it to state on the first apply
with the status creating
and then rely on subsequent apply/plan to trigger a Read that will update the state?
Or should I just poll for status on the first Create until the status becomes succeeded
or failed
. This option might introduce other issues like timeouts. And since creating a resource might than half an hour not sure it’s the best approach if I want to create 10s of resources.
Could also be a combination of both: poll for some time in the Create, then just save whatever the status I get into the state on timeout. And rely of later refreshes to update my resources.
I was wondering if there is a correct approach Terraform recommends.