Parsing a variable from a configuration file

I’d like to extract a value from a variable, the default value in this code excerpot:

variable "kubespray_inventory" {
  description = "Directory containing Kubespray (ansible) inventory file"
  type        = string
  default     = "ca_bdc"

I can do this via using perl or awk etc inside a provisioner, however - because its not a great practice to use one language inside another, is there a more elegant way of doing this - something almost like a reverse template_file ?


This is a destroy provisioner I am using, as such you cannot use variables, I have a work around for what I want to do - not as slick/elegant as I would like, but it works.