Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to connect to Azure through terraform #15487

Closed
Shaybs opened this issue Feb 17, 2022 · 3 comments
Closed

Trying to connect to Azure through terraform #15487

Shaybs opened this issue Feb 17, 2022 · 3 comments

Comments

@Shaybs
Copy link

Shaybs commented Feb 17, 2022

Terraform (and AzureRM Provider) Version

Terraform v1.1.6
on linux_amd64

  • provider registry.terraform.io/hashicorp/azurerm v2.96.0

Affected Resource(s)

All

Terraform Configuration Files

terraform {
  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = "=2.96.0"
    }
  }
}

PROVIDERS

provider "azurerm" {
  features {}

  subscription_id = var.azure-creds.sub-id
  client_id       = var.azure-creds.client-id
  client_secret   = var.azure-creds.client-secret
  tenant_id       = var.azure-creds.tenant-id
}

Expected Behaviour

Terraform to refresh state

Actual Behaviour

╷
│ Error: Unable to list provider registration status, it is possible that this is due to invalid credentials or the service principal does not have permission to use the Resource Manager API, Azure error: resources.ProvidersClient#List: Failure sending request: StatusCode=0 -- Original Error: context canceled
│
│   with provider["registry.terraform.io/hashicorp/azurerm"],
│   on deployment.tf line 10, in provider "azurerm":
│   10: provider "azurerm" {
│

Steps to Reproduce

  1. Use terraform apply or 'terraform plan' and it will get stuck

Important Factoids

Never had this issue before

@seumasdunlop
Copy link

seumasdunlop commented Feb 17, 2022

I enabled trace logging and noticed that we're getting these errors.
2022-02-18T10:11:07.487+1300 [DEBUG] provider.terraform-provider-azurerm_v2.96.0_x5: AzureRM Request: GET /subscriptions/[redacted]/providers?api-version=2016-02-01 HTTP/1.1 Host: management.azure.com User-Agent: Go/go1.17.5 (amd64-linux) go-autorest/v14.2.1 Azure-SDK-For-Go/v61.4.0 resources/2016-02-01 HashiCorp Terraform/1.0.9 (+https://www.terraform.io) Terraform Plugin SDK/2.10.1 terraform-provider-azurerm/2.96.0 pid-222c6c49-1b0a-5959-a213-6608f9eb8820 X-Ms-Correlation-Request-Id: cf32146a-9b63-4a9f-5d38-b4b9cc8d6e60 Accept-Encoding: gzip: timestamp=2022-02-18T10:11:07.487+1300 2022-02-18T10:11:07.524+1300 [DEBUG] provider.terraform-provider-azurerm_v2.96.0_x5: AzureRM Response Error: Get "https://management.azure.com/subscriptions/[redacted]/providers?api-version=2016-02-01": dial tcp: lookup management.azure.com on 172.29.144.1:53: cannot unmarshal DNS message for https://management.azure.com/subscriptions/[redacted]/providers?api-version=2016-02-01: timestamp=2022-02-18T10:11:07.524+1300

A quick google showed several recent go issues when using WSL so I tried in a Linux VM and it worked.

@tombuildsstuff
Copy link
Contributor

👋

As @seumasdunlop has mentioned above, we've had a few reports of users encountering this issue when using WSL - from our research it appears to be an issue where the IPv4 addresses aren't correctly resolved by the default DNS server when running in WSL.

Other users have been able to workaround this by updating their DNS Servers (to CloudFlare/Google/OpenDNS etc) within WSL which has fixed this for them - however since this appears to be a WSL issue rather than something specific to Terraform, I'm going to close this issue for the moment but I'd recommend opening an issue on the WSL repository where someone from Microsoft should be able to take a look.

Thanks!

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants