I am trying to fetch json content from azure function app and saving the output to a file. But somehow it is appending escape characters in each line. Please let me know if I am doing something wrong. Thanks in advance.
Below is the sample json
{
"alias": "XXX-ED",
"name": "XXX-ED | XXX Cloud | Dev/Test",
"prefix": "xxxed",
"id": 12345,
"cluster": 3,
"ZoneName": "East US 2",
"EnvironmentName": "Dev/Test"
}
terraform code
variable "resource_group_name" {
type = string
description = "nameof resource group name"
}
data "azurerm_windows_function_app" "az_function" {
name = "xxx"
resource_group_name = var.resource_group_name
}
data "azurerm_function_app_host_keys" "az_function_key"{
name = "xxx"
resource_group_name = var.resource_group_name
}
locals {
func_uri = "https://${data.azurerm_windows_function_app.az_function.default_hostname}/api/xxx/?code=${data.azurerm_function_app_host_keys.az_function_key.default_function_key}"
}
data "http" "http_data" {
url = local.func_uri
#module.function_app.uri
method = "GET"
request_headers = {
Accept = "application/json"
}
}
resource "local_file" "config" {
content = data.http.http_data.response_body
filename = "xxxconfig.json"
}
output "uri" {
value = local_file.config.filename
}
output file
[
"{",
"t"Clients":[",
"tt{",
"ttt"alias": "XXX-ED",",
"ttt"name": "XXX-ED | XXX Cloud | Dev/Test",",
"ttt"prefix": "xxxed",",
"ttt"id": 12345,",
"ttt"cluster": 3,",
"ttt"ZoneName": "East US 2",",
"ttt"EnvironmentName": "Dev/Test","
]",
"}"
]