Write a JSON File as a DynamoDB Table Item

I have an application that can read a JSON file from a DynamoDB table item at startup and use it for configuration. I have a dynamodb table that has 2 columns, “id” and “json”.
I need to insert a value into that file using the template function for Terraform for a server url. I’m trying to load the file into DynamoDB with the “aws_dynamodb_table_item” resource after its rendered with the correct server url.

data "template_file" "config_tpl" {
  template = file("${path.root}/config/config.json.tpl")
  vars = {
    server_url = aws_route53_record.cloudfront_cname.fqdn

resource "aws_dynamodb_table_item" "config_json" {
  table_name = aws_dynamodb_table.my_table.id
  hash_key   = "id"
  item       = <<ITEM
  "id": {"S": "config"},
  "json": {"S": "${data.template_file.config_json_tpl.rendered}"}

I’m able to do this in the console, however, when running through TF, I get the following error:

Error: Invalid format of "item": Decoding failed: invalid character '\n' in string literal
  on dynamodb.tf line 41, in resource "aws_dynamodb_table_item" "config_json":
  41:   item       = <<ITEM
  42: {
  43:   "id": {"S": "config"},
  44:   "json": {"S": "${data.template_file.config_json_tpl.rendered}"}
  45: }
  46: ITEM

Is it possible to load an entire JSON file as an item using this resource?

I hope this article can help