We are managing Cloudfront with Terraform and keep seeing timeouts before the deployment is complete or modified. It does take a fair bit of time to deploy ( 20 mins ). The error that I see -
Error: error waiting until CloudFront Distribution (<>) is deployed: RequestError: send request failed caused by: Get https://cloudfront.amazonaws.com/<>: read tcp <>><>: read: connection reset by peer
Is there a way I can make terraform cli wait for the apply to complete successfully or is it timing out connecting to the s3 backend ?
Have you verified that you can make the connection to https://cloudfront.amazonaws.com/ from where Terraform is running?
-bash-4.2# curl -I https://cloudfront.amazonaws.com/
HTTP/1.1 404 Not Found
Date: Wed, 12 Aug 2020 05:43:17 GMT
404 is okay, it show that the connection has been established
It does connect to CloudFront and modifies it, but times-out before the modification is complete - we are using lambdaEdge so it take time for propagation
We ran into the same errors when updating the min ssl protocol version of the cloudfront distribution. The update was successful though.