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.59k stars 4.62k forks source link

add a big caveat that a azurerm_managed_disk cannot be named "app_data" and maybe other reserved names #8129

Closed rgl closed 3 years ago

rgl commented 4 years ago

Community Note

Terraform (and AzureRM Provider) Version

Terraform v0.13.0
+ provider registry.terraform.io/hashicorp/azurerm v2.23.0
+ provider registry.terraform.io/hashicorp/random v2.3.0
+ provider registry.terraform.io/hashicorp/template v2.1.2

Affected Resource(s)

Terraform Configuration Files

resource "azurerm_managed_disk" "example" {
  # NB you MUST not use "app_data" name. That name seems to be reserved,
  #    maybe because ASP.NET uses that name as a reserved directory?
  name                 = "app_data"
  resource_group_name  = azurerm_resource_group.example.name
  location             = azurerm_resource_group.example.location
  create_option        = "Empty"
  disk_size_gb         = 10
  storage_account_type = "StandardSSD_LRS"
}

Debug Output

azurerm_managed_disk.example: Creating...

Error: Error creating/updating Managed Disk "app_data" (Resource Group "rgl-managed-disk-example"): compute.DisksClient#CreateOrUpdate: Failure sending request: StatusCode=404 -- Original Error: Code="Failed" Message="The async operation failed."

  on main.tf line 40, in resource "azurerm_managed_disk" "example":
  40: resource "azurerm_managed_disk" "example" {

Logs:

2020-08-14T11:39:31.963+0100 [INFO]  plugin.terraform-provider-azurerm_v2.23.0_x5: [INFO] preparing arguments for Azure ARM Managed Disk creation.
2020-08-14T11:39:31.963+0100 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5: [DEBUG] AzureRM Request: 
2020-08-14T11:39:31.963+0100 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5: GET /subscriptions/REDACTED/resourceGroups/rgl-managed-disk-example/providers/Microsoft.Compute/disks/app_data?api-version=2019-11-01 HTTP/1.1
2020-08-14T11:39:31.963+0100 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5: Host: management.azure.com
2020-08-14T11:39:31.963+0100 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5: User-Agent: Go/go1.14.5 (amd64-linux) go-autorest/v14.0.0 Azure-SDK-For-Go/v44.2.0 compute/2019-12-01 HashiCorp Terraform/0.13.0 (+https://www.terraform.io) Terraform Plugin SDK/1.13.1 terraform-provider-azurerm/2.23.0 pid-222c6c49-1b0a-5959-a213-6608f9eb8820
2020-08-14T11:39:31.963+0100 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5: X-Ms-Correlation-Request-Id: 152dec67-c79d-85dd-a003-deffa9d3a2f6
2020-08-14T11:39:31.963+0100 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5: Accept-Encoding: gzip
2020-08-14T11:39:31.963+0100 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5: 
2020-08-14T11:39:31.963+0100 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5: 
2020-08-14T11:39:32.070+0100 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5: [DEBUG] AzureRM Response for https://management.azure.com/subscriptions/REDACTED/resourceGroups/rgl-managed-disk-example/providers/Microsoft.Compute/disks/app_data?api-version=2019-11-01: 
2020-08-14T11:39:32.070+0100 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5: HTTP/2.0 404 Not Found
2020-08-14T11:39:32.070+0100 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5: Date: Fri, 14 Aug 2020 10:39:31 GMT
2020-08-14T11:39:32.070+0100 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5: Server: Microsoft-IIS/10.0
2020-08-14T11:39:32.070+0100 [DEBUG] plugin.terraform-provider-azurerm_v2.23.0_x5: Content-Length: 0

Expected Behavior

I expected to use any name as a resource name. But that boat already floated... so: any of these would be ok for me:

  1. blacklist the reserved names at the terraform plan phase.
  2. warn the user about this potential problem, because the error currently returned misleading

Actual Behavior

A strange error was returned and a 404 was in the logs:

https://management.azure.com/subscriptions/REDACTED/resourceGroups/rgl-managed-disk-example/providers/Microsoft.Compute/disks/**app_data**?api-version=2019-11-01 HTTP/2.0 404 Not Found Server: Microsoft-IIS/10.0

That is using IIS, and by default IIS restricts at lot of files/url-segments, maybe this is what is happening here, because app_data is normally restricted by default?

Steps to Reproduce

  1. terraform apply

References

favoretti commented 3 years ago

Thanks for opening this issue! Since this issue has been reported a long time ago and relates to an older version of provider - I'm going to close it. If this is still relevant and occurring on the latest version of terraform and provider please do open a new issue!

github-actions[bot] commented 3 years ago

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.