@Herbst Stefanie (PS/PJ-SOFC-CPS) - Welcome to Microsoft Q&A and thanks for reaching out to us.
In order to add a datasource to Grafana using Terraform, you can use grafana_data_source
resource. Have you tried using that?
If not, please look at the example configuration and see if it helps.
resource "grafana_data_source" "example" {
name = "Example Datasource"
type = "prometheus"
url = "http://prometheus.example.com"
access_mode = "proxy"
basic_auth_username = "username"
basic_auth_password = "password"
is_default = true
}
Here in the above example, we are creating a Prometheus DataSource named "Example Datasource" with the URL "http://prometheus.example.com", also setting the access mode to "proxy" and providing basic authentication credentials. Finally, we are setting this DataSource as the default DataSource.
You can customize this configuration to match your specific DataSource requirements. For more information about the grafana_data_source
resource and its properties, refer this doc: ttps://registry.terraform.io/providers/grafana/grafana/latest/docs/resources/data_source
Hope this helps. and please feel free to reach out if you have any further questions.
If the above response was helpful, please feel free to "Accept as Answer" and click "Yes" so it can be beneficial to the community.