terraform-provider-azurerm: azurerm_application_insights Unable to Deploy or Import App Insights
Is there an existing issue for this?
- I have searched the existing issues
Community Note
- Please vote on this issue by adding a đ reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave â+1â or âme tooâ comments, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Terraform Version
1.1.2
AzureRM Provider Version
3.7.0
Affected Resource(s)/Data Source(s)
azurerm_application_insights
Terraform Configuration Files
app_insights.tf
module "application_insights_int_sbx_01" {
source = "../../modules/application_insights"
name = "appin-${lookup(local.short_region_names, var.location)}-${var.environment_code}-sh-int-01"
location = module.azurerm_resource_group_int_01.location
resource_group_name = module.azurerm_resource_group_int_01.name
workspace_id = module.log_ana_wrksp_01.id
tags = {
System = "App Insight"
Environment = var.environment
Billing = "Integration"
}
}
main.tf
resource "azurerm_application_insights" "appin_int_01" {
name = var.name
location = var.location
resource_group_name = var.resource_group_name
workspace_id = var.workspace_id
application_type = var.application_type
tags = var.tags
}
variables.tf
variable "name" {
description = "(Required) Specifies the name of the Application Insights component. Changing this forces a new resource to be created."
type = string
}
variable "location" {
description = "(Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created."
type = string
default = "uksouth"
}
variable "resource_group_name" {
description = "(Required) The name of the resource group in which to create the Application Insights component."
type = string
}
variable "workspace_id" {
description = "(Optional) Specifies the id of a log analytics workspace resource"
type = string
}
variable "application_type" {
description = "(Optional) Specifies the id of a log analytics workspace resource"
type = string
default = "web"
}
variable "tags" {
description = "Tags to add to the application insight."
}
Debug Output/Panic Output
â Error: making Read request on AzureRM Application Insights Billing Feature 'appin-uks-pre-sh-int-01': insights.ComponentCurrentBillingFeaturesClient#Get: Failure responding to request: StatusCode=200 -- Original Error: Error occurred unmarshalling JSON - Error = 'json: cannot unmarshal array into Go value of type insights.ApplicationInsightsComponentBillingFeatures' JSON = '[]'
Expected Behaviour
Terraform apply should create the application Insights instance Terraform import should import the application Insights instance
Actual Behaviour
Terraform apply results in the above error, the app insights instance is created. On the next apply Terraform errors that the resource already exists. Terraform Import to try and workaround this fails with the same error so no workaround possible.
Steps to Reproduce
Terraform apply
Important Factoids
Azure UK South
References
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 57
- Comments: 30 (7 by maintainers)
This must be Azure API problem, terraform is just victim here. Indeed resources get created at all times.
I have opened SevB ticket with Azure, Iâm working with them, passing on the information gathered here.
Hope they will fix it soon!
I too have this issue. The same script works on another subscription with same RBAC access, same region. Only difference in subscription type - does NOT work on subscription part of Azure EA Enterprise agreement, but works fine on âpay-as-you-goâ. Not sure if this is related, but the error message seems to related to billing (Insights Billing Feature)! Question - is everyone facing this issue on subscription part of EA?
Hi all,
I can confirm this issue, Iâm unable to create an AppInsights from TF correctly đŚ But the AppInsights seem to be created in Azure, so on next run it saying that AI already exists đŚ
Regards, Alexandre
There is a service heath issue for this: Application Insights - Limited resources in Application Insights - Extended Investigation
Status Active Health Event Type Service Issue Start time 8.6.2022 12.17.42 (for 8 dage siden) End Time
Last update Impact Statement: Starting at 10:17 UTC on 8 June 2022, you have been identified as a customer using Application Insights who may be experiencing issues with your subscriptions that donât have any existing Application Insights resources, creating a new Application Insights resource via Terraform may fail with error. The âUsage and estimated costsâ page of the Application Insights resource may not show the daily cap information.
Current Status: We have engaged additional teams and are actively working on rolling out the hotfix to mitigate the issue. The next update will be provided in 2 hours or as events warrant.
Workaround: Creating a sub-resource (e.g., web test) in the impacted Application Insights component might fix the issue for the whole subscription. If the issue persists, try refreshing the page or opening the impacted blade in a new browser. That sub-resource (e.g., web test) could be deleted immediately once the issue goes away.
https://app.azure.com/h/3_TK-3C0/0ef747
Until then, I put in place workaround to convert to
data
after the initial run creates it but fails to put in state. Maybe it helps someoneâŚWe are getting the same issue. We can also produce a similar error when running the following command
az monitor app-insights component billing show --app xxx-appi -g xxx-rg
This command succeed on other subscriptions where we didnât get the terraforming issue.Yawheeew, so the ticket worked! That was quick.
Indeed, creating
classic test
underavailability
section of the app insight fixes the issue for all insights within the subscription.That gives me hope they will fix it very soon.
Same issue in Terraform 1.2.2 and AzureRM version 3.9.0 and 3.10.0
@RanjithJain77 I have 2 subscriptions, both EA, offer
MS-AZR-0017P
. One of them works, the other fails.I can confirm that creating a âclassic testâ for our App Insights resource in the affected subscription has resolved this same issue with our terraform deployment. Thanks @Tbohunek
I found this issue to day.
Terraform Version
1.2.2
AzureRM Provider Version
3.10
Hi, Iâm facing same issue, but why it throwing error if code 200 - means success?
Itâs also now working for me without implementing the workaround in the same subscription I initially encountered the issue in. Guessing MS have fixed it and are rolling out the fix.
Negative. I just created in a new subscription and still missing cap there. @steindan1 Iâd call you lucky. đ Servicehealth is also still open.
For me it worked today even without the workaround, seems that the issue has been fixed overnight đ
Seems its been known for some time: Starting at 10:17 UTC on 8 June 2022 ?
have same issue, iâve got the error:
` Error: read Application Insights Billing Features âXXXXâ (Resource Group âXXXXXâ): insights.ComponentCurrentBillingFeaturesClient#Get: Failure responding to request: StatusCode=200 â Original Error: Error occurred unmarshalling JSON - Error = âjson: cannot unmarshal array into Go value of type insights.ApplicationInsightsComponentBillingFeaturesâ JSON = â[]â
i notice that the resource (app insight) is created despite the error. When running second time âterraform applyâ i have error that say resource is already existing. i tried with these asurerm version: 2.99.0 ,3.9.0, 3.10.0 `
Just to confirm that this is on Azureâs end, Iâve tried to create an Application Insights instance manually, and I got the below error.