Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provider crash during App Insights create #27341

Closed
1 task done
isaac-s opened this issue Sep 10, 2024 · 3 comments · Fixed by #27352
Closed
1 task done

Provider crash during App Insights create #27341

isaac-s opened this issue Sep 10, 2024 · 3 comments · Fixed by #27352

Comments

@isaac-s
Copy link

isaac-s commented Sep 10, 2024

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 comments along the lines of "+1", "me too" or "any updates", 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 and review the contribution guide to help.

Terraform Version

1.9.5

AzureRM Provider Version

4.1.0

Affected Resource(s)/Data Source(s)

azurerm_application_insights

Terraform Configuration Files

resource "azurerm_application_insights" "insights" {
  resource_group_name = "name"
  location            = "westus"
  name                = "insightsname"
  workspace_id        = "workspaceid"
  application_type    = "web"
  sampling_percentage = 0
  tags                = {
    environment = "qa"
    provisioner = "terraform"
    managed = true
  }
}

Debug Output/Panic Output

Stack trace from the terraform-provider-azurerm_v4.1.0_x5 plugin:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x4dbf169]

goroutine 233 [running]:
github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights.resourceApplicationInsightsCreateUpdate(0x0?, {0x729e040?, 0xc001fcf680})
        github.com/hashicorp/terraform-provider-azurerm/internal/services/applicationinsights/application_insights_resource.go:290 +0x1509
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0x8b0c578?, {0x8b0c578?, 0xc004f90750?}, 0xd?, {0x729e040?, 0xc001fcf680?})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/resource.go:766 +0x163
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc000b8d500, {0x8b0c578, 0xc004f90750}, 0xc001b2f110, 0xc004c9ae00, {0x729e040, 0xc001fcf680})
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/resource.go:909 +0xa89
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc0008e19f8, {0x8b0c578?, 0xc004f90660?}, 0xc004f94000)
        github.com/hashicorp/terraform-plugin-sdk/v2@v2.33.0/helper/schema/grpc_provider.go:1078 +0xdbc
github.com/hashicorp/terraform-plugin-mux/tf5muxserver.(*muxServer).ApplyResourceChange(0x8b0c5b0?, {0x8b0c578?, 0xc004f90360?}, 0xc004f94000)
        github.com/hashicorp/terraform-plugin-mux@v0.15.0/tf5muxserver/mux_server_ApplyResourceChange.go:36 +0x193
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc00154afa0, {0x8b0c578?, 0xc004df9b30?}, 0xc0017d7810)
        github.com/hashicorp/terraform-plugin-go@v0.23.0/tfprotov5/tf5server/server.go:865 +0x3d0
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x7fbde60?, 0xc00154afa0}, {0x8b0c578, 0xc004df9b30}, 0xc004c9ab80, 0x0)
        github.com/hashicorp/terraform-plugin-go@v0.23.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:518 +0x169
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000231000, {0x8b0c578, 0xc004df9aa0}, {0x8b38f60, 0xc000223c80}, 0xc004f88360, 0xc001668cf0, 0xe173798, 0x0)
        google.golang.org/grpc@v1.63.2/server.go:1369 +0xe23
google.golang.org/grpc.(*Server).handleStream(0xc000231000, {0x8b38f60, 0xc000223c80}, 0xc004f88360)
        google.golang.org/grpc@v1.63.2/server.go:1780 +0x1016
google.golang.org/grpc.(*Server).serveStreams.func2.1()
        google.golang.org/grpc@v1.63.2/server.go:1019 +0x8b
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 39
        google.golang.org/grpc@v1.63.2/server.go:1030 +0x135

Error: The terraform-provider-azurerm_v4.1.0_x5 plugin crashed!

Expected Behaviour

No response

Actual Behaviour

No response

Steps to Reproduce

No response

Important Factoids

No response

References

No response

@isaac-s
Copy link
Author

isaac-s commented Sep 10, 2024

This also happens with 4.0.1.

@isaac-s
Copy link
Author

isaac-s commented Sep 10, 2024

I believe I have a good lead.
This happened coincidentally as I was shifting around some permissions.

I executed a trace and got this (private info masked):

2024-09-10T09:18:36.229-0700 [DEBUG] provider.terraform-provider-azurerm_v4.1.0_x5: [DEBUG] GET https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myrg/providers/Microsoft.Insights/components/myappinsights/currentbillingfeatures?api-version=2015-05-01
2024-09-10T09:18:37.045-0700 [DEBUG] provider.terraform-provider-azurerm_v4.1.0_x5: [DEBUG] AzureRM Response for https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myrg/providers/Microsoft.Insights/components/myappinsights/currentbillingfeatures?api-version=2015-05-01: 
2024-09-10T09:18:37.045-0700 [DEBUG] provider.terraform-provider-azurerm_v4.1.0_x5: HTTP/2.0 200 OK
2024-09-10T09:18:37.045-0700 [DEBUG] provider.terraform-provider-azurerm_v4.1.0_x5: Content-Length: 12
2024-09-10T09:18:37.045-0700 [DEBUG] provider.terraform-provider-azurerm_v4.1.0_x5: Cache-Control: no-cache
2024-09-10T09:18:37.045-0700 [DEBUG] provider.terraform-provider-azurerm_v4.1.0_x5: Content-Type: application/json; charset=utf-8
2024-09-10T09:18:37.045-0700 [DEBUG] provider.terraform-provider-azurerm_v4.1.0_x5: Date: Tue, 10 Sep 2024 16:18:36 GMT
2024-09-10T09:18:37.045-0700 [DEBUG] provider.terraform-provider-azurerm_v4.1.0_x5: Expires: -1
2024-09-10T09:18:37.045-0700 [DEBUG] provider.terraform-provider-azurerm_v4.1.0_x5: Pragma: no-cache
2024-09-10T09:18:37.045-0700 [DEBUG] provider.terraform-provider-azurerm_v4.1.0_x5: Strict-Transport-Security: max-age=31536000; includeSubDomains
2024-09-10T09:18:37.045-0700 [DEBUG] provider.terraform-provider-azurerm_v4.1.0_x5: X-Cache: CONFIG_NOCACHE
2024-09-10T09:18:37.045-0700 [DEBUG] provider.terraform-provider-azurerm_v4.1.0_x5: X-Content-Type-Options: nosniff
2024-09-10T09:18:37.045-0700 [DEBUG] provider.terraform-provider-azurerm_v4.1.0_x5: X-Ms-Correlation-Request-Id: ef3b9229-3015-a102-f7c8-e2cf3410f1c1
2024-09-10T09:18:37.045-0700 [DEBUG] provider.terraform-provider-azurerm_v4.1.0_x5: X-Ms-Request-Id: 33883cc4-5c51-4abf-be9e-fe399493873e
2024-09-10T09:18:37.045-0700 [DEBUG] provider.terraform-provider-azurerm_v4.1.0_x5: X-Ms-Routing-Request-Id: CANADACENTRAL:20240910T161836Z:33883cc4-5c51-4abf-be9e-fe399493873e
2024-09-10T09:18:37.045-0700 [DEBUG] provider.terraform-provider-azurerm_v4.1.0_x5: X-Msedge-Ref: Ref A: 7044CE5BAC6549EBA8B9A157B523DE91 Ref B: CO6AA3150219053 Ref C: 2024-09-10T16:18:36Z
2024-09-10T09:18:37.045-0700 [DEBUG] provider.terraform-provider-azurerm_v4.1.0_x5
2024-09-10T09:18:37.045-0700 [DEBUG] provider.terraform-provider-azurerm_v4.1.0_x5: {"value":[]}
2024-09-10T09:18:37.047-0700 [DEBUG] provider.terraform-provider-azurerm_v4.1.0_x5: panic: runtime error: invalid memory address or nil pointer dereference
2024-09-10T09:18:37.047-0700 [DEBUG] provider.terraform-provider-azurerm_v4.1.0_x5: [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x4dbf169]

I then added the following permission:

Microsoft.Insights/components/currentbillingfeatures/read

And that helped me past the segfault.

@teowa
Copy link
Contributor

teowa commented Sep 12, 2024

Hi @isaac-s , the issue will be fixed by #27352, which will release at 4.2.0 version. Thanks.

@github-actions github-actions bot added this to the v4.3.0 milestone Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants