Cause
Hello, I'm raising this issue as a general notification that Terraform 1.1.6 appears to be impacted by this issue in go:
golang/go#51127
It is fixed upstream in Go as of 1.18rc1
Workaround
Add an entry for management.azure.com to your windows hosts file or /etc/hosts
Terraform Version
Terraform Configuration Files
terraform {
required_version = "1.1.6"
required_providers {
null = {
source = "hashicorp/null"
version = "3.1.0"
}
}
backend "azurerm" {
storage_account_name = "terraformissuerepro"
resource_group_name = "terraform-issue"
container_name = "terraform"
key = "state.tfstate"
}
}
resource "null_resource" "nothing" {
}
Debug Output
❯ TF_LOG=trace terraform init
2022-02-18T13:18:28.384+1000 [INFO] Terraform version: 1.1.6
2022-02-18T13:18:28.384+1000 [INFO] Go runtime version: go1.17.2
2022-02-18T13:18:28.384+1000 [INFO] CLI args: []string{"terraform", "init"}
2022-02-18T13:18:28.384+1000 [TRACE] Stdout is a terminal of width 120
2022-02-18T13:18:28.384+1000 [TRACE] Stderr is a terminal of width 120
2022-02-18T13:18:28.385+1000 [TRACE] Stdin is a terminal
2022-02-18T13:18:28.385+1000 [DEBUG] Attempting to open CLI config file: /home/nickwb/.terraformrc
2022-02-18T13:18:28.385+1000 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2022-02-18T13:18:28.385+1000 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
2022-02-18T13:18:28.385+1000 [DEBUG] ignoring non-existing provider search directory /home/nickwb/.terraform.d/plugins
2022-02-18T13:18:28.385+1000 [DEBUG] ignoring non-existing provider search directory /home/nickwb/.local/share/terraform/plugins
2022-02-18T13:18:28.385+1000 [DEBUG] ignoring non-existing provider search directory /usr/local/share/terraform/plugins
2022-02-18T13:18:28.385+1000 [DEBUG] ignoring non-existing provider search directory /usr/share/terraform/plugins
2022-02-18T13:18:28.385+1000 [INFO] CLI command args: []string{"init"}
Initializing the backend...
2022-02-18T13:18:28.386+1000 [TRACE] Meta.Backend: built configuration for "azurerm" backend with hash value 273801300
2022-02-18T13:18:28.386+1000 [TRACE] Meta.Backend: backend has not previously been initialized in this working directory2022-02-18T13:18:28.386+1000 [DEBUG] New state was assigned lineage "3ae48c02-93d2-dcc3-8249-d79c9d6acd1d"
2022-02-18T13:18:28.386+1000 [TRACE] Meta.Backend: moving from default local state only to "azurerm" backend
2022-02-18T13:18:28.387+1000 [DEBUG] checking for provisioner in "."
2022-02-18T13:18:28.389+1000 [DEBUG] checking for provisioner in "/usr/bin"
2022-02-18T13:18:28.389+1000 [TRACE] backend/local: state manager for workspace "default" will:
- read initial snapshot from terraform.tfstate
- write new snapshots to terraform.tfstate
- create any backup at terraform.tfstate.backup
2022-02-18T13:18:28.389+1000 [TRACE] statemgr.Filesystem: reading initial snapshot from terraform.tfstate
2022-02-18T13:18:28.389+1000 [TRACE] statemgr.Filesystem: snapshot file has nil snapshot, but that's okay
2022-02-18T13:18:28.389+1000 [TRACE] statemgr.Filesystem: read nil snapshot
2022-02-18T13:18:28.389+1000 [TRACE] Meta.Backend: ignoring local "default" workspace because its state is empty
2022-02-18T13:18:28.389+1000 [INFO] Testing if Service Principal / Client Certificate is applicable for Authentication..
2022-02-18T13:18:28.389+1000 [INFO] Testing if Multi Tenant Service Principal / Client Secret is applicable for Authentication..
2022-02-18T13:18:28.389+1000 [INFO] Testing if Service Principal / Client Secret is applicable for Authentication..
2022-02-18T13:18:28.389+1000 [INFO] Testing if Managed Service Identity is applicable for Authentication..
2022-02-18T13:18:28.389+1000 [INFO] Testing if Obtaining a Multi-tenant token from the Azure CLI is applicable for Authentication..
2022-02-18T13:18:28.389+1000 [INFO] Testing if Obtaining a token from the Azure CLI is applicable for Authentication..
2022-02-18T13:18:28.389+1000 [INFO] Using Obtaining a token from the Azure CLI for Authentication
2022-02-18T13:18:29.068+1000 [INFO] Getting OAuth config for endpoint https://login.microsoftonline.com/ with tenant REDACTED
2022-02-18T13:18:29.068+1000 [DEBUG] Obtaining a ADAL / Azure Active Directory Graph token for Resource Manager..
2022-02-18T13:18:29.651+1000 [DEBUG] New state was assigned lineage "3374ba2d-3cad-67ab-35c5-baa2260a0376"
2022-02-18T13:18:29.651+1000 [DEBUG] Building the Container Client from an Access Token (using user credentials)
2022-02-18T13:18:29.654+1000 [DEBUG] Azure Backend Request:
POST /subscriptions/REDACTED/resourceGroups/terraform-issue/providers/Microsoft.Storage/storageAccounts/terraformissuerepro/listKeys?api-version=2021-01-01 HTTP/1.1
Host: management.azure.com
User-Agent: Terraform/1.1.6
Content-Length: 0
Accept-Encoding: gzip
2022-02-18T13:18:29.711+1000 [DEBUG] Request to https://management.azure.com/subscriptions/REDACTED/resourceGroups/terraform-issue/providers/Microsoft.Storage/storageAccounts/terraformissuerepro/listKeys?api-version=2021-01-01 completed with no response
Expected Behavior
Successful init/plan/apply.
Actual Behavior
Terraform hangs after DNS resolution to management.azure.com
Steps to Reproduce
terraform init
References
golang/go#51127
Cause
Hello, I'm raising this issue as a general notification that Terraform 1.1.6 appears to be impacted by this issue in go:
golang/go#51127
It is fixed upstream in Go as of 1.18rc1
Workaround
Add an entry for
management.azure.comto your windows hosts file or/etc/hostsTerraform Version
Terraform Configuration Files
Debug Output
Expected Behavior
Successful init/plan/apply.
Actual Behavior
Terraform hangs after DNS resolution to
management.azure.comSteps to Reproduce
terraform initReferences
golang/go#51127