grafana / crossplane-provider-grafana

Crossplane provider of https://github.com/grafana/terraform-provider-grafana. Generated by https://github.com/upbound/upjet
Apache License 2.0
25 stars 13 forks source link

org_id is only supported with basic auth. API keys are already org-scoped #144

Closed Hronom closed 1 month ago

Hronom commented 2 months ago

Hello, is there was some recent changes in grafana cloud? We start getting error:

    - lastTransitionTime: '2024-05-13T15:15:31Z'
      message: >-
        create failed: failed to create the resource: [{0 org_id is only
        supported with basic auth. API keys are already org-scoped  []}]
      reason: ReconcileError
      status: 'False'
      type: Synced

Version: v0.14.1 Same also in v0.16.1

Hronom commented 2 months ago

Seems like deletion of orgId: "1" in configs helps. For example I deleted in dashboard and it start work.

Old:

apiVersion: oss.grafana.crossplane.io/v1alpha1
kind: Dashboard
metadata:
  name: ...
spec:
  forProvider:
    orgId: "1"
    folder: ...
    configJson: ...
    overwrite: true
  providerConfigRef:
    name: ...

New:

apiVersion: oss.grafana.crossplane.io/v1alpha1
kind: Dashboard
metadata:
  name: ...
spec:
  forProvider:
    folder: ...
    configJson: ...
    overwrite: true
  providerConfigRef:
    name: ...
julienduchesne commented 2 months ago

That is expected. You can only set the orgID of a resource when using basic auth. The reason for that is that the Grafana API will silently ignore the org ID when a SA token is used, leading to confusion when users try to deploy resources in another org

Hronom commented 1 month ago

Thanks, this helps