newrelic / terraform-provider-newrelic

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

fix(synthetics): add error handling to multilocation alert condition for invalid GUIDs #2641

Closed abasha1234 closed 2 months ago

abasha1234 commented 2 months ago

Description

This PR includes changes for error handling when an invalid monitor ID is provided for the resource newrelic_synthetics_multilocation_alert_condition.

Ticket : https://new-relic.atlassian.net/browse/NR-257490

Fixes # (issue) Issue: https://github.com/newrelic/terraform-provider-newrelic/issues/2631

Before the changes, getMonitorID() fails with panic on wrong monitor ID

Screenshot 2024-04-24 at 10 27 06

After the changes, getMonitorID() throwing an error

Screenshot 2024-04-24 at 10 50 25

Checklist:

Please delete options that are not relevant.

abasha1234 commented 2 months ago

The PR change has been validated with the following cases

invalid monitor_id

Screenshot 2024-04-25 at 16 34 55

monitor_id as empty string

Screenshot 2024-04-25 at 16 35 42
pranav-new-relic commented 2 months ago

Awesome 👍