terraform-provider-grafana icon indicating copy to clipboard operation
terraform-provider-grafana copied to clipboard

Validate that clients exist in all resources

Open julienduchesne opened this issue 3 years ago • 0 comments

This is a long standing issue, since we started using the provider for multiple things (SM, Grafana, Cloud, Oncall) You can now configure your provider in a way that is valid but not for the resources you are using Example, configuring a cloud provider but using a Grafana resource

The OnCall team added a validation on all of their resources, which works but is a bit tedious This PR adds a validation on every resource, the corresponding client has to exist at read and create time

Here's what an error looks like:

│ Error: the Grafana client is required for `grafana_data_source`. Set the auth and url provider attributes
│
│   with grafana_data_source.elasticsearch-arbitrary,
│   on test-2022-08-24-datasources.tf line 14, in resource "grafana_data_source" "elasticsearch-arbitrary":
│   14: resource "grafana_data_source" "elasticsearch-arbitrary" {

Instead of Error: Post "/api/v1/provisioning/contact-points": unsupported protocol scheme ""

Fixes #610

julienduchesne avatar Aug 25 '22 13:08 julienduchesne