When using Terraform to configure Azure resources, you may get an unhelpful error message (from
terraform apply) similar to the following:
module.<name>.<resource>.<name>: Creating... ╷ │ Error: Error creating/updating Some Thing. Component: Failure sending request: StatusCode=409 -- Original Error: autorest/azure: Service returned an error. Status=<nil> <nil>
TF_LOG='DEBUG' will dump the HTTP responses to
stderr, but it’s extremely verbose and hard to find the
information you’re looking for. A much easier way to view HTTP responses is by using a HTTP debugger such as Fiddler.
There are a few setup steps you need to perform to enable this:
certmgr.mscand in Intermediate Certification Authorities > Certificates, find
C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\certifi\cacert.pemin a text editor running as Administrator.
Then, to debug Terraform requests:
terraform applyand watch the requests stream into Fiddler.
Posted by Bradley Grainger on April 21, 2021