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.46k stars 4.54k forks source link

importing resource failure due to capitalization on azurerm_web_application_firewall_policy #16072

Open Aeternax opened 2 years ago

Aeternax commented 2 years ago

TF version: 1.1.7 azurerm version: 3.0.1 (also at least 2.99 and 2.85)

Command run:

terraform import azurerm_web_application_firewall_policy.firewall /subscriptions/....................../resourceGroups/XXXXXXXXXXXXXXXXXXXXX-RSG/providers/Microsoft.Network/applicationGatewayWebApplicationFirewallPolicies/yyyyyyyyyyyyyyy

Problem encountered:

Error: ID was missing the ApplicationGatewayWebApplicationFirewallPolicies element │ │ with azurerm_web_application_firewall_policy.firewall, │ on firewall.tf line 1, in resource "azurerm_web_application_firewall_policy" "firewall": │ 1: resource "azurerm_web_application_firewall_policy" "firewall" {

Workaround:

Making capital A on ApplicationGatewayWebApplicationFirewallPolicies. The azure portal returns the ID with a lowercase a.

On at least azurerm version 2.67 the import "succeeded" but will largely be empty.

neil-yechenwei commented 2 years ago

thanks for raising this issue. Per the doc descirption, seems the section ApplicationGatewayWebApplicationFirewallPolicies is expected.

wvannuffele4 commented 1 year ago

This is a bug in the Azure portal, not the AzureRM provider. The resource JSON correctly lists the resource id with a capitalized A.