hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.61k stars 4.65k forks source link

azurerm_storage_blob - upload VHD - error HTTP response was nil; connection may have been reset #25589

Open jdestombes opened 7 months ago

jdestombes commented 7 months ago

Is there an existing issue for this?

Community Note

Terraform Version

1.7.5

AzureRM Provider Version

3.98.0

Affected Resource(s)/Data Source(s)

azurerm_storage_blob

Terraform Configuration Files

## Upload the Master Image VHD
resource "azurerm_storage_blob" "CC-AZ-STORAGE-MASTERIMG" {
  depends_on             = [azurerm_storage_container.CC-AZ-STORAGE,time_sleep.wait_3_minutes]
  name                   = "${var.azurerm-UploadVHD-name}"
  storage_account_name   = azurerm_storage_account.CC-AZ-STORAGE.name
  storage_container_name = azurerm_storage_container.CC-AZ-STORAGE.name
  type                   = "${var.azurerm-UploadVHD-type}"
  source                 = "${var.azurerm-UploadVHD-source}"
}

Debug Output/Panic Output

╷
│ Error: creating Blob "master-win2022-vda2311.vhd" (Account "Account \"stxxxxx\" (IsEdgeZone false / ZoneName \"\" / Subdomain Type \"blob\" / DomainSuffix \"core.windows.net\")" / Container Name "scxxxxx"): creating storage blob on Azure: while uploading source file "C:\\Terraform\\xxxxx\\Module1\\Master\\master-win2022-vda2311.vhd": writing page at offset 4289097728 for file "C:\\Terraform\\AnetysCafe\\Module1\\Master\\master-win2022-vda2311.vhd": executing request: Put "https://stxxxxx.blob.core.windows.net/scxxxxxx/master-win2022-vda2311.vhd?comp=page": HTTP response was nil; connection may have been reset
│
│   with azurerm_storage_blob.CC-AZ-STORAGE-MASTERIMG,
│   on CConAZUpload-main.tf line 31, in resource "azurerm_storage_blob" "CC-AZ-STORAGE-MASTERIMG":
│   31: resource "azurerm_storage_blob" "CC-AZ-STORAGE-MASTERIMG" {
│
╵

Expected Behaviour

VHD should be uploaded (issue is not present with azruerm 3.0.0)

Actual Behaviour

Connection Reset

Steps to Reproduce

terraform apply

Important Factoids

No response

References

No response

jdestombes commented 7 months ago

Issue appears with version 3.85.0 Version 3.84.0 upload the VHD correctly

magodo commented 7 months ago

@jdestombes Could you please provide a complete configuration with the storage account and the blob, with values interpolated, so that we can take a further look?

JelleBroekhuijsen commented 7 months ago

I am also experiencing this behavior on azurerm_storage_account when running a large config that interacts with a large number of storageaccounts. Running from ADO pipeline agent hosted on Azure Container Instance (Windows) using provider hashicorp/azurerm v3.100.0, also experiencing this on 3.99.

│ Error: building Accounts Data Plane Client: retrieving Storage Account Key: listing Keys for Storage Account (Subscription: "2ccab7fe-ac67-49ce-974e-11a8da78fb5f"
│ Resource Group Name: "xxxxx"
│ Storage Account Name: "xxxxx"): Post "[https://management.azure.com/subscriptions/xxxxx/resourceGroups/xxxxx/providers/Microsoft.Storage/storageAccounts/xxxxx/listKeys?%24expand=kerb&api-version=2023-01-01"](https://management.azure.com/subscriptions/xxxxx/resourceGroups/xxxxx/providers/Microsoft.Storage/storageAccounts/xxxxx/listKeys?%24expand=kerb&api-version=2023-01-01%22): HTTP response was nil; connection may have been reset
│ 
│   with module.hyper_v_arcservers_rg.module.hyper_v_host_resources["hv27"].azurerm_storage_account.xxxxx,
│   on modules\arc-hyper-v-host-resources\storageaccount.tf line 1, in resource "azurerm_storage_account" "arc_hyper_v_host":
│    1: resource "azurerm_storage_account" "arc_hyper_v_host" {
magodo commented 7 months ago

From another report I've received, this error might indicates the service is rate limiting your access. I'm not sure if it is intermittent, but you can probably avoid it by not sending too many requests at once.

jdestombes commented 6 months ago

From another report I've received, this error might indicates the service is rate limiting your access. I'm not sure if it is intermittent, but you can probably avoid it by not sending too many requests at once.

You are right, set parralelism to 1 solved the issue.

leowaisblatt commented 6 months ago

FYI setting parallelism to 1 did not solve it for me. running in azure pipeline

sushmitapandey commented 6 months ago

I am also getting the same error "HTTP response was nil; connection may have been reset" for different resources- private endpoint, function app, route tables, proximity placement group with the az api version 1.10 and 1.12.

gstvo2k15 commented 2 weeks ago

I´m having same problem trying with azurerm ~> 3.100 and setting paralelism to 1:

module.vm["vm-ubuntu-20"].azurerm_storage_blob.vhd_blob[0]: Still creating... [18m30s elapsed] module.vm["vm-ubuntu-20"].azurerm_storage_blob.vhd_blob[0]: Still creating... [18m40s elapsed] module.vm["vm-ubuntu-20"].azurerm_storage_blob.vhd_blob[0]: Still creating... [18m50s elapsed] module.vm["vm-ubuntu-20"].azurerm_storage_blob.vhd_blob[0]: Still creating... [19m0s elapsed]

╷ │ Error: creating Blob "VM-6.vhd" (Account "Account \"predsacvhd\" (IsEdgeZone false / ZoneName \"\" / Subdomain Type \"blob\" / DomainSuffix \"core.windows.net\")" / Container Name "vmimage"): creating storage blob on Azure: while uploading source file "/home/user/Downloads/VM-6.vhd": writing page at offset 3543965696 for file "/home/user/Downloads/VM-6.vhd": executing request: Put "https://vhd.blob.core.windows.net/vmimage/VM-6.vhd?comp=page": HTTP response was nil; connection may have been reset │ │ with module.vm["dsac-scanning-ubuntu-20"].azurerm_storage_blob.vhd_blob[0], │ on ../../../terraform-vm-linux-module/main.tf line 234, in resource "azurerm_storage_blob" "vhd_blob": │ 234: resource "azurerm_storage_blob" "vhd_blob" {

In other cases I saw that probably setting this could be helpful but not works... Ex: timeouts { create = "90m" }