-
Notifications
You must be signed in to change notification settings - Fork 267
Description
I think a basic feature that is missing in this provider is the ability to specify to which org you would like a resource to belong. I understand this is in part due to the construction of the Grafana API. The Grafana API is not RESTful, since it maintains an internal state variable of the current_org
between API calls. This is makes implementing this feature slightly more difficult.
This is a crucial feature since internally, each Grafana API object is implicitly linked to an org_id
. Therefore, in order to align the Terraform Provider with the data-model used by Grafana, the resources should also have an org_id
field.
Affected Resource(s)
Please list the resources as a list, for example:
- All resources except for
grafana_organization
Expected Behavior
The below example is just done with grafana_data_source
but applies to every resource in the provider.
Given a sample resource configuration like this:
provider "grafana" {
url = "http://localhost:3000/"
auth = "admin:admin"
}
resource "grafana_organization" "org1" {
name = "test-provider1"
admin_user = "admin"
}
resource "grafana_organization" "org2" {
name = "test-provider2"
admin_user = "admin"
}
resource "grafana_data_source" "metrics" {
type = "graphite"
name = "myapp-metrics-test"
org_id = "${grafana_organization.org1.id}"
}
resource "grafana_data_source" "metrics2" {
type = "graphite"
name = "myapp-metrics-test2"
org_id = "${grafana_organization.org2.id}"
}
resource "grafana_data_source" "metrics3" {
type = "graphite"
name = "myapp-metrics-test3"
org_id = "${grafana_organization.org1.id}"
}
resource "grafana_data_source" "metrics4" {
type = "graphite"
name = "myapp-metrics-test4"
org_id = "${grafana_organization.org2.id}"
}
We should expect for 2 datasources to be created in 2 different orgs, like so:
and
Actual Behavior
An error because these fields are not available in the current version of the provider
References
Related issues: https://github.com/terraform-providers/terraform-provider-grafana/issues/31#issuecomment-491044905