I am relatively new to terraform and I am using terraform version 0.11.14. When I tried to run terraform apply or terraform destroy, terraform command execution failed to complete from time to time. The failure reason can be due to errors like:
aws_vpc.vpc: RequestError: send request failed caused by: Post https://ec2.us-west-2.amazonaws.com/: local error: tls: unexpected message
I found similar discussion wrt to this error (e.g. #16448). The " tls: unexpected message" error is intermittent and usually disappear after I retry the terraform command.
However the following command need manual intervention to remove the record.
Error building changeset: InvalidChangeBatch: [Tried to create resource record set [name='a.mydomain.com.', type='A'] but it already exists] status code: 400, request id: c0dcf73-6ffe-4d3-8cea-09cc3
I like to know what is the good practice to handle terraform failures. Write a script to detect all possible errors? e.g. for intermittent error and start over again by doing terraform plan and terraform apply? Does terraform has retry mechanism?