terraform-provider-newrelic
terraform-provider-newrelic copied to clipboard
Terraform Apply fails with Plugin Crashed Error NR Version 2.42.1
Hi there,
Thank you for opening an issue. In order to better assist you with your issue, we kindly ask to follow the template format and instructions. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests only. General usage questions submitted as issues will be closed and redirected to New Relic's Explorers Hub https://discuss.newrelic.com/c/build-on-new-relic/developer-toolkit.
Please include the following with your bug report
:warning: Important: Failure to include the following, such as omitting the Terraform configuration in question, may delay resolving the issue.
- [ ] Your New Relic
provider
configuration (sensitive details redacted) - [ ] A list of affected resources and/or data sources
- [ ] The configuration of the resources and/or data sources related to the bug report (i.e. from the list mentioned above)
- [ ] Description of the current behavior (the bug)
- [ ] Description of the expected behavior
- [ ] Any related log output
Terraform Version
Terraform v1.1.7 on linux_amd64
- provider registry.terraform.io/newrelic/newrelic v2.42.1
Affected Resource(s)
-
newrelic_nrql_alert_condition
Terraform Configuration
Please include your
provider
configuration (sensitive details redacted) as well as the configuration of the resources and/or data sources related to the bug report.
resource "newrelic_nrql_alert_condition" "alert_condition" {
account_id = var.NEW_RELIC_ACCOUNT_ID
policy_id = var.alert_policy_id
type = "static"
name = "High Memory Utilization on New Relic Pods Alert"
description = "Alert when New Relic Pods are utilizing very High Memory"
enabled = false
violation_time_limit_seconds = 259200
aggregation_window = 60
aggregation_method = "event_flow"
aggregation_delay = 120
nrql {
query = "FROM Metric SELECT latest(k8s.container.memoryWorkingSetUtilization) FACET k8s.clusterName, k8s.podName, containerName WHERE (clusterName IN ('example_cluster_name') AND namespace IN ('newrelic'))"
}
critical {
operator = "above"
threshold = 90
threshold_duration = 300
threshold_occurrences = "ALL"
}
}
Actual Behavior
Initializing the backend...
Successfully configured the backend "http"! Terraform will automatically
use this backend unless the backend configuration changes.
Initializing provider plugins...
- Reusing previous version of newrelic/newrelic from the dependency lock file
- Using previously-installed newrelic/newrelic v2.42.1
Terraform has been successfully initialized!
newrelic_nrql_alert_condition.alert_condition: Creating...
╷
│ Error: Plugin did not respond
│
│ with newrelic_nrql_alert_condition.alert_condition,
│ on main.tf line 23, in resource "newrelic_nrql_alert_condition" "alert_condition":
│ 23: resource "newrelic_nrql_alert_condition" "alert_condition" {
│
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details.
╵
Stack trace from the terraform-provider-newrelic_v2.42.1 plugin:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0xa0 pc=0xf064b3]
goroutine 30 [running]:
github.com/newrelic/terraform-provider-newrelic/v2/newrelic.resourceNewRelicNrqlAlertConditionCreate(0x13f9598, 0xc000694c00, 0xc000125700, 0x104f160, 0xc0004c7c50, 0xc0004d96d0, 0xaaa84a, 0xc000125580)
/home/runner/work/terraform-provider-newrelic/terraform-provider-newrelic/newrelic/resource_newrelic_nrql_alert_condition.go:437 +0x7d3
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0xc00025b7a0, 0x13f9528, 0xc0002584c0, 0xc000125700, 0x104f160, 0xc0004c7c50, 0x0, 0x0, 0x0)
/home/runner/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:341 +0x17f
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc00025b7a0, 0x13f9528, 0xc0002584c0, 0xc000516750, 0xc000125580, 0x104f160, 0xc0004c7c50, 0x0, 0x0, 0x0, ...)
/home/runner/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:467 +0x67b
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc000126798, 0x13f9528, 0xc0002584c0, 0xc0006444b0, 0xc0002584c0, 0x1174b80, 0xc0005e8100)
/home/runner/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:977 +0xacf
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc000657320, 0x13f95d0, 0xc0002584c0, 0xc0005f6000, 0xc000657320, 0xc0005e8150, 0xc00072bba0)
/home/runner/go/pkg/mod/github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:332 +0xb5
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler(0x1174b80, 0xc000657320, 0x13f95d0, 0xc0005e8150, 0xc0006945a0, 0x0, 0x13f95d0, 0xc0005e8150, 0xc0006a5000, 0x7d3)
/home/runner/go/pkg/mod/github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:380 +0x214
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000142540, 0x1403758, 0xc00029d380, 0xc00056e000, 0xc0007a4540, 0x1a605e0, 0x0, 0x0, 0x0)
/home/runner/go/pkg/mod/google.golang.org/[email protected]/server.go:1194 +0x52b
google.golang.org/grpc.(*Server).handleStream(0xc000142540, 0x1403758, 0xc00029d380, 0xc00056e000, 0x0)
/home/runner/go/pkg/mod/google.golang.org/[email protected]/server.go:1517 +0xd0c
google.golang.org/grpc.(*Server).serveStreams.func1.2(0xc00011c2f0, 0xc000142540, 0x1403758, 0xc00029d380, 0xc00056e000)
/home/runner/go/pkg/mod/google.golang.org/[email protected]/server.go:859 +0xab
created by google.golang.org/grpc.(*Server).serveStreams.func1
/home/runner/go/pkg/mod/google.golang.org/[email protected]/server.go:857 +0x1fd
Error: The terraform-provider-newrelic_v2.42.1 plugin crashed!
This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.
Expected Behavior
Terraform Applies the Plan Successfully in New Relic.
Steps to Reproduce
Please list the steps required to reproduce the issue, for example: terraform plan and apply the following code
resource "newrelic_nrql_alert_condition" "alert_condition" {
account_id = var.NEW_RELIC_ACCOUNT_ID
policy_id = var.alert_policy_id
type = "static"
name = "High Memory Utilization on New Relic Pods Alert"
description = "Alert when New Relic Pods are utilizing very High Memory"
enabled = false
violation_time_limit_seconds = 259200
aggregation_window = 60
aggregation_method = "event_flow"
aggregation_delay = 120
nrql {
query = "FROM Metric SELECT latest(k8s.container.memoryWorkingSetUtilization) FACET k8s.clusterName, k8s.podName, containerName WHERE (clusterName IN ('example_cluster_name') AND namespace IN ('newrelic'))"
}
critical {
operator = "above"
threshold = 90
threshold_duration = 300
threshold_occurrences = "ALL"
}
}
@ktumu0225, Thanks for reporting the issue. We will take a look into it.
@ktumu0225, we tried to recreate the issue with the provided script and noticed that it's working as expected. Could you try again and let us know if you are encountering with the same error.
@sandeepkumar-kagitha I'm still receiving the same error. May I know how to debug the error message or any steps that I can perform to check where my configuration is failing.
I am having the same issue with version 2.43.4
Solved it
It turns out that my configuration was wrong, I did not declare NEW_RELIC_REGION
environment variable. The provider use US
region as default, but my account is in EU
Maybe it can help you @ktumu0225 :pray:
Thanks @rinzool We'll take a look to improve the error message.
Using the INGEST - LICENSE
key instead of USER
key also caused a segfault on 2.44.0:
Stack trace from the terraform-provider-newrelic_v2.44.0 plugin:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x19c1f77]
goroutine 81 [running]:
github.com/newrelic/terraform-provider-newrelic/v2/newrelic.resourceNewRelicCloudGcpLinkAccountCreate({0x1e9c168, 0xc000102c60}, 0x1b037a0?, {0x1aeede0?, 0xc0008bc750?})
/home/runner/work/terraform-provider-newrelic/terraform-provider-newrelic/newrelic/resource_newrelic_cloud_gcp_link_account.go:59 +0x137
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0xc00022ca80, {0x1e9c0f8, 0xc0000a0500}, 0x2?, {0x1aeede0, 0xc0008bc750})
/home/runner/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:341 +0x12e
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc00022ca80, {0x1e9c0f8, 0xc0000a0500}, 0xc00072e270, 0xc00021b300, {0x1aeede0, 0xc0008bc750})
/home/runner/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:467 +0x6f1
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc0001a0438, {0x1e9c0f8, 0xc0000a0500}, 0xc0006d8500)
/home/runner/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:977 +0xd8a
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc00009de80, {0x1e9c1a0?, 0xc0005063c0?}, 0x2?)
/home/runner/go/pkg/mod/github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:332 +0x6c
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler({0x1bffa80?, 0xc00009de80}, {0x1e9c1a0, 0xc0005063c0}, 0xc000102360, 0x0)
/home/runner/go/pkg/mod/github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:380 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0004c2700, {0x1ea03d0, 0xc000676000}, 0xc00030a200, 0xc00028a990, 0x251e0e0, 0x0)
/home/runner/go/pkg/mod/google.golang.org/[email protected]/server.go:1194 +0xc8f
google.golang.org/grpc.(*Server).handleStream(0xc0004c2700, {0x1ea03d0, 0xc000676000}, 0xc00030a200, 0x0)
/home/runner/go/pkg/mod/google.golang.org/[email protected]/server.go:1517 +0xa1b
google.golang.org/grpc.(*Server).serveStreams.func1.2()
/home/runner/go/pkg/mod/google.golang.org/[email protected]/server.go:859 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
/home/runner/go/pkg/mod/google.golang.org/[email protected]/server.go:857 +0x28a
Error: The terraform-provider-newrelic_v2.44.0 plugin crashed!
This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.