Terraform-provider-azurerm: azurerm_managed_disk on v1.37.0 failing for missing parameter storageAccountId but not on v1.36.1

Created on 26 Nov 2019  ·  5Comments  ·  Source: terraform-providers/terraform-provider-azurerm

Terraform version

Terraform v0.11.13
+ provider.azurerm v1.37.0
+ provider.null v2.1.2

UPDATE:
also with terraform 0.12:

Terraform v0.12.16
+ provider.azurerm v1.37.0
+ provider.null v2.1.2

Terraform Configuration File

resource "azurerm_managed_disk" "portal_os_disk" {
  name                 = "a_test-45271_engine_os_1"
  location             = "northeurope"
  resource_group_name  = "a_test-45271"
  source_uri           = "https://XXXXXXXXXXX-azure.vhd"
  storage_account_type = "Standard_LRS"
  create_option        = "Import"
  os_type              = "Linux"
}

The storage account is on the same subscription as the disk being created

Error:

[DEBUG] plugin.terraform-provider-azurerm_v1.37.0_x4: {
[DEBUG] plugin.terraform-provider-azurerm_v1.37.0_x4:   "error": {
[DEBUG] plugin.terraform-provider-azurerm_v1.37.0_x4:     "code": "BadRequest",
[DEBUG] plugin.terraform-provider-azurerm_v1.37.0_x4:     "message": "Required parameter 'storageAccountId' is missing (null)."
[DEBUG] plugin.terraform-provider-azurerm_v1.37.0_x4:   }
[DEBUG] plugin.terraform-provider-azurerm_v1.37.0_x4: }

Removing .terraform and changing the version of the plugin to 1.36.1 the result is success

As it can be seen on the log, the call for 1.37.0 is to the:
.....Microsoft.Compute/disks/a_test-45271_engine_os_1?api-version=2019-07-01
and the call for 1.36.1 is:
.....Microsoft.Compute/disks/a_test-45271_engine_os_1?api-version=2019-03-01

Either way the api reference says that "storageAccounId" is not required in neither of the api versions unless the blob is on different subscription:
https://docs.microsoft.com/en-gb/azure/templates/microsoft.compute/2019-07-01/disks
https://docs.microsoft.com/en-gb/azure/templates/microsoft.compute/2019-03-01/disks

bug regression servicdisks

Most helpful comment

Same issue here, v1.36.1 works fine.

All 5 comments

The problem is occurring in the latest versions of both the terraform and the plugin too:

Terraform v0.12.16
+ provider.azurerm v1.37.0
+ provider.null v2.1.2

Error: compute.DisksClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: Code="BadRequest" Message="Required parameter 'storageAccountId' is missing (null)."

Same issue here, v1.36.1 works fine.

Just in case it isn't obvious to others who get here, you can pin your provider version to the older rev like this until the issue is fixed:

provider "azurerm" {
  version = "=1.36.1"
  ...
}

This has been released in version 1.41.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
    version = "~> 1.41.0"
}
# ... other configuration ...

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

Was this page helpful?
0 / 5 - 0 ratings