-
Notifications
You must be signed in to change notification settings - Fork 219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request]: grafana_data_source data allow non-existing datasource #1408
Comments
I think a |
So currently our problem is this one here. there is a race condition between the loki and tempo datasource
|
Gotcha. A listing datasource would work here then. No choice but to have a two-step apply though |
Hey @julienduchesne , |
Would it be possible to create a separate That resource could be called resource "grafana_data_source" "tempo" {
name = "tempo"
}
resource "grafana_data_source" "loki" {
name = "loki"
}
resource "grafana_data_source_config" "tempo" {
uid = grafana_data_source.tempo.uid
json_data_encoded = jsonencode({
# ...
datasourceUid = grafana_data_source.loki.uid
# ...
})
}
resource "grafana_data_source_config" "loki" {
uid = grafana_data_source.loki.uid
json_data_encoded = jsonencode({
# ...
datasourceUid = grafana_data_source.tempo.uid
# ...
})
}
|
Splitting the resource would be the only possible way to do this in a single apply, indeed. It does require a lot of changes to resources though and is prone to breaking existing functionality (unless they're two completely new resources, ds_without_config, ds_config) |
It does not necessarily break the existing functionality. If there is a new resource only for the This approach would fix the multi-step apply issue (circular dependency) and not force any changes to the existing code using grafana provider. As I can see, this approach is used by |
Yeah, I get that. The part that's weird to me is that, unlike an S3 bucket, a Grafana datasource is non-functional without its config. So the bare grafana_data_source resource would just not work on its own, which for a core resource, feels not OK. |
Hmm, excellent point there! However, that is not what I was suggesting. By adding the config resource and leaving the existing one unchanged, we enable the configuration through the data source resource (no need for an additional resource). On top of that, we also allow for a single-step deployment of examples such as the above. What troubles me, is that anyone wanting to use vanilla Terraform to deploy a common configuration like Loki and Tempo logs and traces correlation is forced to change the whole pipeline by introducing additional deployment steps. I find it a red flag for the provider, unfortunately. |
👍 Adding a new "config" resource and leaving the possibility to configure datasources as a single unit is probably what I'd do |
Great! |
I am this project's dictator. It's accepted. I'd accept a PR for it, but can't promise an ETA otherwise |
Feature Request
Currently the
data "grafana_data_source"
returns error 404 if the datasource doesn't exist.This is problematic for us since the tempo and loki datasource require one another on some feature flags.
Would it be possible to allow
data "grafana_data_source"
to work with non-existing datasources and don't let terraform fail if the datasource doesn't exist?The text was updated successfully, but these errors were encountered: