Fixes #2675
(fixes a mishandled condition in #2672)
Summary
It has been reported via #2675 that (with the latest release of the provider, v3.37.0) running a terraform plan on configuration comprising of widget_billboard in the resource newrelic_one_dashboard is running into panic, and is hence, failing.
Shift to versions < v3.36.0 of the Terraform Provider using terraform init -upgrade and run a terraform plan and a terraform apply on the configuration. After this, run a terraform plan again and you will see no error.
Now, try shifting to version 3.37.0 of the provider again, using terraform init -upgrade and then run a terraform plan on the same configuration again. The stack trace reported in the issue linked above may be obtained.
Additional point: Upon recreating all of the above scenario without the second billboard widget in the configuration attached above, the observation that this failure is seen with billboard widgets only when they do not have a threshold defined has been made
(i.e., running this scenario only with the second billboard widget does not seem to throw an error). This helps hint at the fact that something isn't right with the logic when the read function is called by the resource, pertaining to billboard widgets only when they contain threshold specifications (critical and/or warning) and the issue is not seen when neither of warning and critical are specified
The Fix
Based on the observation made above, it appears that the absence of a condition to handle the case when the Thresholds attribute of the dashboard's RawConfiguration is nil (only in the case of billboard widgets) is leading to this failure; adding a relevant condition should fix the problem, which is what this PR aims at doing.
Merging this PR as the change made has been thoroughly tested manually (with the steps documented above), and no failures are seen in relevant integration tests.
Fixes #2675 (fixes a mishandled condition in #2672)
Summary
It has been reported via #2675 that (with the latest release of the provider,
v3.37.0
) running aterraform plan
on configuration comprising ofwidget_billboard
in the resourcenewrelic_one_dashboard
is running into panic, and is hence, failing.Steps to Reproduce
v3.36.0
of the Terraform Provider usingterraform init -upgrade
and run aterraform plan
and aterraform apply
on the configuration. After this, run aterraform plan
again and you will see no error.3.37.0
of the provider again, usingterraform init -upgrade
and then run aterraform plan
on the same configuration again. The stack trace reported in the issue linked above may be obtained.critical
and/orwarning
) and the issue is not seen when neither ofwarning
andcritical
are specifiedThe Fix
Based on the observation made above, it appears that the absence of a condition to handle the case when the
Thresholds
attribute of the dashboard'sRawConfiguration
is nil (only in the case of billboard widgets) is leading to this failure; adding a relevant condition should fix the problem, which is what this PR aims at doing.