When Terraform encounters an error writing to state, it generates an errored.tfstate file. This file allows for the restoration of the state under typical conditions. At this time, when using TF Agents, this file is inaccessible.
Error: Failed to save state
Error saving state: error uploading state: 502 Bad Gateway
Error: Failed to persist state to backend
The error shown above has prevented Terraform from writing the updated state to the configured backend. To allow for recovery, the state has been written to the file "errored.tfstate" in the current working directory. Running "terraform apply" again at this point will create a forked state, making it harder to recover. To retry writing this state, use the following command: terraform state push errored.tfstate
The path forward to prevent a forked state is to perform a terraform import of the objects that failed to ingress during the previous run.