newrelic / terraform-provider-newrelic

Terraform provider for New Relic
https://registry.terraform.io/providers/newrelic/newrelic/latest/docs
Mozilla Public License 2.0
202 stars 245 forks source link

Return error from getMonitorID instead of panic #2632

Closed guineveresaenger closed 5 months ago

guineveresaenger commented 5 months ago

Description

fix: Adds error handling and slice length check for getMonitorId synthetics resource helpers.

Fixes #2631

Type of change

Please delete options that are not relevant.

Checklist:

Please delete options that are not relevant.

How to test this change?

I am a little unclear on how to build/test this provider locally. The contributor instructions do not say how to set up my TF configuration to use a local provider. Unfortunately, internet results vary as well.

I also am unable to run make test; I get errors relating to build constraints:

 make test
tools.go:7:2: import "github.com/bflad/tfproviderlint/cmd/tfproviderlint" is a program, not an importable package
=== terraform-provider-newrelic === [ tools            ]: Installing tools required by the project...
package github.com/newrelic/terraform-provider-newrelic/v2/tools: build constraints exclude all Go files in /Users/guin/go/src/github.com/guineveresaenger/terraform-provider-newrelic/tools
make: *** [tools] Error 1

To test, I would build this provider locally and run the program that triggered the panic and hopefully get an error instead! update: I figured out how to attach a local provider binary and with that I get an error as expected.

I am very happy to work with you on testing but I'd like some pointers on how to set up a local provider and why make is failing for me.

CLAassistant commented 5 months ago

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant commented 5 months ago

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

pranav-new-relic commented 5 months ago

Thank you for the contribution, @guineveresaenger - we would like to take this further via PR #2640 as our team believes there is scope for further error handling and better test coverage of such a scenario, so we shall continue to build via the PR linked above to resolve the issue you've posted :) thank you again for helping set a direction and giving us hints, via this PR!