-
Notifications
You must be signed in to change notification settings - Fork 229
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
Allow for org_id field in resource definitions #59
Comments
Pull RequestOpened pull request to add this feature here: https://github.com/terraform-providers/terraform-provider-grafana/pull/60 |
I'd like to have this feature. Waiting for it. |
The pull request implementing org_id in resources was closed in favor to org_id in the provider (#60) Unfortunately, this doesn't allow to create and populate organisation and resources in it in one run of terraform. Only objects in existing orgs can be created which is somehow halfway, in my opinion. Should this approach be reconsidered? |
Most API endpoints do not support the org id parameter and in cases where they do, the header seems to have priority. I feel like support would be all over the place if we were to allow org_id in some resources. There is one exception, which is the admin API: https://grafana.com/docs/grafana/latest/http_api/admin/ As described here: https://grafana.com/docs/grafana/latest/http_api/auth/#x-grafana-org-id-header, the header has no effect in that API To answer your question (on how to create an org and then use it in a single TF file), you can use multiple providers:
|
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 anorg_id
field.Affected Resource(s)
Please list the resources as a list, for example:
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:
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
The text was updated successfully, but these errors were encountered: