For provider plugin development, how to solve the api timeout problem, for example, the creation of resource A is more time-consuming, in the execution of terraform apply command, I wrote a polling method to check the status of resource A in the create method of resource A, when the detection of the resource A is created successfully, the create method of resource A will end normally.
This is a common situation where tf executes apply , and provider execution times out. However, the real resources may be created eventually, but there is no way to subsequently manage the resources that were actually created through tf.
Even if you have an API call timeout before Terraform itself times out, the provider can always return a state value along with the error. That returned state is stored by Terraform, and as long as it contains attributes which can identify the instance, it can be used to later delete or recover it.
If you don’t have enough information to identify the new resource, and the API call failed before supplying you with the necessary data, then that is something lacking in the remote system which Terraform cannot help you recover from.