Automated import of Grafana dashboard not finding Prometheus Datasource

I’m new to Grafana and Prometheus and am trying to automate an installation based on an existing Grafana setup that we have, including using a dashboard which I exported from the existing system.

I’m running Grafana 8.0.6 and Prometheus 2.28.1 on CentOS Linux 7.

When testing, I manually created the Prometheus datasource (running on the same server as Grafana on port 9090). The add/test button returns successful. When testing the manual import of the dashboard .json file, it asks me to select the Datasource, for which I select the Prometheus datasource, and the dashboard comes up and displays everything perfectly.

After the successful manual test, I created the datasource/default.yaml for Prometheus. It imports and the datasource tests fine. The installation script deploys the dashboard .json to the path specified in the ${WORKING_DIR}/conf/provisioning/dashboards/default.yaml.

However, now when opening the dashboard, it seems that it can’t resolve the Environment variable ${DS_PROMETHEUS} and the charts won’t display.

The inputs section of the dashboard includes:

{
“name”: “DS_PROMETHEUS”,
“label”: “Prometheus”,
“description”: “”,
“type”: “datasource”,
“pluginId”: “prometheus”,
“pluginName”: “Prometheus”
}

Can anybody tell me what I’m missing?

Thanks in advance!