I want to use the format function like below
format(local.nrsql , “‘abc’” , “‘cdf’”)
nrsql = "FROM Metric SELECT filter(count(http.server.requests), WHERE id IN (%s) "
But I am getting the error
Call to function "format" failed: unrecognized format character '\'' at offset 146
I think the error is happening because I am using %s in the nrsql and passing ’ in the parameter. Kindly help to resolve this error .
Is that the entire error message Terraform printed? I worry that it’s incomplete because the corresponding error message code in Terraform itself ends with an integer character offset which seems to be missing from what you’ve shared here. It’d be helpful to see the entire message, including the “Error:” heading, the source code snippet, and the indication of variable values, if any.
@apparentlymart Thank you for the reply .Sorry I am unable to share the entire error as it may expose some organizational data . I think this is happening because the function is expecting %s and I am sending ’ (single colon) in the parameter . I am unable to resolve this error by escaping the ’ (single colon) . Kindly help .My parameter will like this
format(local.nrsql , " ‘abc’ , 'cdf ’ ")
This issue was happening because in my nrql there was something like
"as ‘%’ "
I resolved the issue by modifying it as
"as ‘%%’ "