Best practices for templates and dynamic YAML files

I have a configuration which uses Kubespray - essentially a set of Ansible playbooks used to manage the life cycle of Kubernetes clusters. Some of the configuration for this comes in the form of YAML files, for example k8s-cluster.yml, which contains things such as the container runtime and the version of Kubernetes to be deployed. I’ve taken this and turned into a template so that I can generate a file for the actual deployment of the cluster using value that originate from HCL variables. This works, however, if the YAML file changes in the GitHub repo for Kubespray, I then have to obtain this and recreate the template, which is not a great way of working. I could do something such as embed calls to awk, sed or Perl inside a provisioner, but, embedding one language within another (HCL) is not great either. The specific problem I want to solve in an elegant way is how to use templates when the source of the template is in GitHub and is likely to change.