terraform-provider-azurerm icon indicating copy to clipboard operation
terraform-provider-azurerm copied to clipboard

Application Insights, timeout

Open michelefa1988 opened this issue 3 years ago • 2 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Community Note

  • Please vote on this issue by adding a :thumbsup: 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.2.6

AzureRM Provider Version

3.17.0

Affected Resource(s)/Data Source(s)

azurerm_application_insights

Problem

I have created a various application insights in the past which were working flawlessly for years

Today I did the following:

  • Updated the azurerm_application_insights module by not passing the variable workspace_id

  • Ran terraform

  • Resource created (I could see resource in portal), but terraform remained creating the resource until the agent timedout

  • I later reverted back to my original code (using log analytics), but the terraform run still refuses to be successful.

Terraform Configuration Files


variable "log_analytics_workspace_id" {
  default = null
}

resource "azurerm_application_insights" "application_insights" {
  name                = var.name
  location            = var.location
  resource_group_name = var.resource_group
  application_type    = var.application_type
  workspace_id        = var.log_analytics_workspace_id

  tags = merge(
    var.default_tags
  )
}

Debug Output/Panic Output

module.env-definition.module.application_insights_aks.azurerm_application_insights.application_insights: Still creating... [18m10s elapsed]
module.env-definition.module.application_insights_aks.azurerm_application_insights.application_insights: Still creating... [18m20s elapsed]
module.env-definition.module.application_insights_aks.azurerm_application_insights.application_insights: Still creating... [18m30s elapsed]
module.env-definition.module.application_insights_aks.azurerm_application_insights.application_insights: Still creating... [18m40s elapsed]
module.env-definition.module.application_insights_aks.azurerm_application_insights.application_insights: Still creating... [18m50s elapsed]
module.env-definition.module.application_insights_aks.azurerm_application_insights.application_insights: Still creating... [19m0s elapsed]

Expected Behaviour

terraform eventually finishes :)

Actual Behaviour

Terraform looped infinately, at the end agent timed out after 1 hour

Steps to Reproduce

No response

Important Factoids

No response

References

No response

michelefa1988 avatar Aug 09 '22 12:08 michelefa1988

Hi @michelefa1988 , thanks for opening this issue. Seems I cannot repro this issue. Could you have a try below TF config to check whether the issue still exists? If still exists, could you provide your TF config that trigger this issue? Thanks.

TF config
terraform {
  required_providers {
    azurerm = {
      version = "= 3.17.0"
      source  = "hashicorp/azurerm"
    }
  }
}


provider "azurerm" {
  features {}
}

resource "azurerm_resource_group" "example" {
  name     = "test-application-insights"
  location = "east us"
}

resource "azurerm_log_analytics_workspace" "example" {
  name                = "workspace-test"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
  sku                 = "PerGB2018"
  retention_in_days   = 30
}

module "appinsight" {
  source           = "./module"
  name             = "test-ai"
  location         = azurerm_resource_group.example.location
  resource_group   = azurerm_resource_group.example.name
  application_type = "web"
  log_analytics_workspace_id = azurerm_log_analytics_workspace.example.id
}
Insight Module source (in ./module)
variable "name" {
  default = "test-application-insights"
}

variable "location" {
  default = "east us"
}

variable "resource_group" {
  default = "example-rg"
}

variable "application_type" {
  default = "web"
}

variable "log_analytics_workspace_id" {
  default = null
}

variable "default_tags" {
  default = {
    foo  = "bar"
  }
}


resource "azurerm_application_insights" "application_insights" {
  name                = var.name
  location            = var.location
  resource_group_name = var.resource_group
  application_type    = var.application_type
  workspace_id        = var.log_analytics_workspace_id
  tags = merge(
    var.default_tags
  )
}

teowa avatar Aug 11 '22 04:08 teowa

@teowa I have worked around the issue by adding the resource to the state file manually. Feel free to close unless anyone has the same issue - i don't have the time to troubleshoot it

michelefa1988 avatar Aug 11 '22 11:08 michelefa1988

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.

github-actions[bot] avatar Feb 12 '23 02:02 github-actions[bot]