How add terraform variables in a JSON file

Hey team I’m having trouble finding in the documentation on how to add terraform variables in a JSON file,

I need inject this variable in this JSON,

    mystring = "Test"

resource "grafana_dashboard" "metrics" {
  config_json = file("EC2.json")

In this JSON of this shape but not it works,

"datasource": {
    "type": "CloudWatch",
    "uid": "${local.mystring}"

I did try with var and locals

Hi @gh0st-society,

Can you say more about what happened when you tried this? Ideally, I’d like to see exactly the full error message (or other output) Terraform presented when you tried running terraform apply with this configuration.