Failing to render

Hitting the following error but unsure why, can someone see what I’m missing?

From terraform.tfvars:
proxy = "http://www-proxy-mydomain.com:80"

From server.sh:

#! /bin/bash
sudo tee /etc/systemd/system/crio.service.d/proxy.conf <<EOF
[Service]
Environment="http_proxy=${proxy}"
Environment="https_proxy=${proxy}"
Environment="HTTP_PROXY=${proxy}"
Environment="HTTPS_PROXY=${proxy}"
EOF

From datasources.tf:

data "template_file" "server" {
        template = file("${path.module}/files/server.sh")
        vars = {
               proxy = var.proxy
               }
}
Error: failed to render : <template_file>:4,29-30: Extra characters after interpolation expression; Expected a closing brace to end the interpolation expression, but found extra characters.
  with module.infrastructure.data.template_file.server,
  on modules/terraform-infrastructure/datasources.tf line 1, in data "template_file" "apiserver_install":
  1: data "template_file" "server

Update
base64encode(file("${path.module}/files/server.sh"))

Tried this and it resolved error but still not rendering.

Unable to further edit my question so repying to myself as it may assist someone.

Sorted issue as outlined below.

Removed datasources.tf file and updated main.tf as follows.

        instance_user_data = base64encode(templatefile("${path.module}/files/server.sh", {
          proxy = var.proxy
        }))