Skip to content
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

OrgId cannot be set in provider config secret #23

Closed
patst opened this issue Mar 31, 2023 · 0 comments · Fixed by #24
Closed

OrgId cannot be set in provider config secret #23

patst opened this issue Mar 31, 2023 · 0 comments · Fixed by #24

Comments

@patst
Copy link
Contributor

patst commented Mar 31, 2023

Hey there,

thanks for providing this crossplane provider!

We are having a shared Grafana instance with different organisations for teams. I want to create resources (Folders, API Keys, ...) for the different teams in their organisations.

Since most of the resources do not support setting a OrgId on resource level for the currently published version (grafana/provider-grafana:v0.3.0) I am trying to set the org_id at the ProviderConfig level.

If I set it as number (as it is typed here: https://registry.terraform.io/providers/grafana/grafana/latest/docs#org_id ), I get the following error while trying to create a Folder resource:

status:
  atProvider: {}
  conditions:
    - lastTransitionTime: '2023-03-31T10:31:46Z'
      message: >-
        connect failed: cannot get terraform setup: cannot unmarshal grafana
        credentials as JSON: json: cannot unmarshal number into Go value of type
        string
      reason: ReconcileError
      status: 'False'
      type: Synced

When I change the org_id type to a string a Folder resource is successfully created, but always in the main org with id 1 and not in the org specified in the ProviderConfig.
The same seems to be true for boolean flags like insecure_skip_verify. Which cannot be set as boolean in the JSON config but won't work when set as string value.

My secret for the provider config + config itself:

apiVersion: v1
stringData:
  instanceCredentials:  |
    {
      "auth": "admin:<mypassword>",
      "url": "http://grafana.grafana.svc.cluster.local/",
      "org_id": "6"  # or 6 
    }
kind: Secret
metadata:
  name: grafana-admin-creds
  namespace: crossplane
type: Opaque
---
apiVersion: grafana.crossplane.io/v1beta1
kind: ProviderConfig
metadata:
  name: grafana-provider-admin
spec:
  credentials:
    source: Secret
    secretRef:
      name: grafana-admin-creds
      namespace: crossplane
      key: instanceCredentials
---
apiVersion: oss.grafana.crossplane.io/v1alpha1
kind: Folder
metadata:
  name: testfolder
spec:
  forProvider:
    title: 'Crossplane Folder Test!'
  providerConfigRef:
    name: grafana-provider-admin

Are my assumptions wrong or do you see a error in the configuration?

Thanks for the help and providing this!

patst added a commit to patst/crossplane-provider-grafana that referenced this issue Apr 3, 2023
Refs: grafana#23
Signed-off-by: patst <patrick.steinig@googlemail.com>
julienduchesne pushed a commit that referenced this issue Apr 12, 2023
Refs: #23

Signed-off-by: patst <patrick.steinig@googlemail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant