Hi! I am working on a script to export and import alertrules, contactpoints, folders and policies to version our monitoring and alerting configuration as code.
Exporting resources as json is working fine, importing mostly so far. I am using JQ to replace resource IDs ahead of importing to match the exported resources. Still I am getting the error
{"message":"invalid alert rule: folderUID must be set","traceID":""}%
when importing the alert-rules api export. Example of my exported json files:
folders.json:
[{"id":884,"uid":"ce1q6efcq2ubka","title":"1"},{"id":186,"uid":"ae08zxo0atvr4f","title":"2"},{"id":155,"uid":"cdyuo4d5ddfcwb","title":"3"}]
alertrules.json:
[{"id":7,"uid":"ae0ckily3162oe","orgID":1,"folderUID":"ae08zxo0atvr4f","ruleGroup":"5m","title":"dev","condition":"B","data":[{"refId":"A","queryType":"","relativeTimeRange":{"from":900,"to":0},"datasourceUid":"P6956E1DFFD6851CF","model":{"dataset":"fx","datasource":{"type":"mysql","uid":"P6956E1D .... (truncated) ]
Grafana version is Grafana v11.4.0 (b58701869e).
Thanks in advance for any helpful pointers or solutions. KR Luis