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>
Setting 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.msc
and in Intermediate Certification Authorities > Certificates, find DO_NOT_TRUST_FiddlerRoot
.C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\certifi\cacert.pem
in a text editor running as Administrator.Then, to debug Terraform requests:
$env:HTTP_PROXY='http://127.0.0.1:8888'; $env:HTTPS_PROXY='http://127.0.0.1:8888'
terraform apply
and watch the requests stream into Fiddler.Posted by Bradley Grainger on April 21, 2021