Datadog query is invalid while executing terraform scripts but manual creation of datadog monitors is working fine with the same

Common.tfvars

cache_connection_down = 0

local.tf

locals {
cache_connection_down =“logs(""name"\:"Cache connection","status"\:"DOWN"").index("*").rollup("count").by("host,service").last("5m") > ${var.cache_connection_down}”
}

main.tf

Use partial configuration to pass credentials from the command line or config file

terraform {
backend “gcs” {}
}
resource “datadog_monitor” “cache_connection_down” {
name = “Cache connection is DOWN”
type = “log alert”
message = “{{#is_alert}}Cache connection is DOWN on host - {{host.name}}, service - {{service.name}}{{/is_alert}}”

query = local.cache_connection_down

notify_no_data = false
tags = [“resource:logs”]
}

provider.tf

terraform {
required_providers {
datadog = {
source = “datadog/datadog”
version = “>= 3.1.2”
}
}
required_version = “>= 0.12.31”
}

provider “datadog” {
api_key = var.datadog_api_key
app_key = var.datadog_app_key
}
variables.tf

variable “datadog_api_key” {
type = string
description = “Datadog API Key”
}

variable “datadog_app_key” {
type = string
description = “Datadog Application Key”
}

variable “email_notification” {
type = string
description = “The email notification”
}
variable “cache_connection_down” {
type = string
description = “The number of cache connection down logging”
}

getting an error
While executing terraform init it has been successfully initialized! But executing terraform apply giving an error while executing above code getting below error ╷
│ Error: error validating monitor from https://api.datadoghq.com/api/v1/monitor/143285119/validate: 400 Bad Request: {“errors”:[“The value provided for parameter ‘query’ is invalid: Invalid query: Check for invalid tags or facets in your query.”]}

│ with datadog_monitor.cache_connection_down,
│ on main.tf line 138, in resource “datadog_monitor” “cache_connection_down”:
│ 138: resource “datadog_monitor” “cache_connection_down” {

understand the reason of troughing an error of number of double quotes in query unable to fix in terraform