Azure Remote State - Error Retrieving Keys

Good afternoon. I’m hoping someone can help me understand why this is happening. Spinning up a new stack in a new region. ts init creates the resource group, the storage account, and the container, but will not create the blob for the state file. In addition, an existing state file is unable to be downloaded for an existing stack. This was working until recently. Thanks in advance.

Changing Azure region to westus.
Execute terraspace to deploy stack - fortigateTransitCommon in Azure region - westus.
Building .terraspace-cache/westus/dev/stacks/fortigateTransitCommon
Creating Resource Group rg-terraform-resources-westus...
Creating Storage Account sa4c16westus...
Creating Storage Container terraform-state...
Downloading tfstate files for dependencies defined in tfvars...

Error loading the state: Error retrieving keys for Storage Account "sa4c16westus": storage.AccountsClient#ListKeys: Failure sending request: StatusCode=0 -- Original Error: Post "https://management.azure.com/subscriptions/xxx/resourceGroups/rg-terraform-resources-westus/providers/Microsoft.Storage/storageAccounts/sa4c16westus/listKeys?api-version=2021-01-01": dial tcp: lookup management.azure.com on 172.23.16.1:53: cannot unmarshal DNS message

Please ensure that your Terraform state exists and that you've
configured it properly. You can use the "-state" flag to point
Terraform at another state file.
Error running: cd /opt/terraspaceProjects/azureSecureTransit/.terraspace-cache/westus/dev/stacks/paloAltoTransitEgressIngress && terraform state pull > /tmp/terraspace/remote_state/stacks/paloAltoTransitEgressIngress/state.json

Wondering if pulling the state works when you run it manually. IE:

cd .terraspace-cache/westus/dev/stacks/paloAltoTransitEgressIngress
terraform state pull

Also, what versions are you using:

  • terraspace
  • terraspace_plugin_azurerm

Check that they’re all up to date.

Also, curious to see what’s different about the backend.tf.

cat .terraspace-cache/westus/dev/stacks/paloAltoTransitEgressIngress/backend.tf

And also the other one. It’s fine to redact the info. Maybe check the differences though.

It looks to be an issue with the windows WSL. MS broke something again. can it be? lol. For anyone else having the same problem, see this - https://github.com/microsoft/WSL/issues/8022. Thanks again.

1 Like