OrgId cannot be set in provider config secret
patst opened this issue · 0 comments
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!