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.63k forks source link

Error when importing a sentinel workbook using azurerm_application_insights_workbook #18051

Closed wanpengyang closed 2 years ago

wanpengyang commented 2 years ago

Is there an existing issue for this?

Community Note

Terraform Version

1.2.1

AzureRM Provider Version

3.19.1

Affected Resource(s)/Data Source(s)

azurerm_application_insights_workbook

Terraform Configuration Files

terraform {
  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = "=3.19.1"
    }
  }
}

provider "azurerm" {
  features {
    resource_group {
      prevent_deletion_if_contains_resources = true
    }
    template_deployment {
      delete_nested_items_during_deletion = false
    }
  }

}

data "azurerm_client_config" "current" {}

data "azurerm_resource_group" "logging_rg" {
  name = "logging_rg"
}

data "azurerm_log_analytics_workspace" "workspace" {
  name                = "log-analytics-workspace"
  resource_group_name = data.azurerm_resource_group.logging_rg.name
}

resource "azurerm_application_insights_workbook" "aws_network" {

}

Debug Output/Panic Output

│ Error: parsing Resource ID "resource_id": parsing "resource_id": parsing segment "staticMicrosoftInsights": expected the segment "microsoft.insights" to be "Microsoft.Insights"

Expected Behaviour

Sentinel workbook imported to terraform

Actual Behaviour

Error

Steps to Reproduce

terraform import azurerm_application_insights_workbook.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.Insights/workbooks/resource1

Important Factoids

No response

References

https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/application_insights_workbook#import

ms-zhenhua commented 2 years ago

Hi @wanpeng-cds, thank you for reaching out. It seems that microsoft.insights is used in the resource_id which causes the error. Since the segment is case sensitive when running terraform import command, could you kindly help double confirm that the segment below you used in the command is Microsoft.Insights rather than microsoft.insights?

terraform import azurerm_application_insights_workbook.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.Insights/workbooks/resource1

wanpengyang commented 2 years ago

Hi @ms-zhenhua , thanks for the help, yes the problem was that microsoft.insights was used instead of Microsoft.Insights

github-actions[bot] commented 2 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.