I'm trying to run the following lines of shell script:
var_files=$(var_file_selector)
echo ${var_files}
terraform apply ${var_files} deploy/$1
Where var_files resolves to "deploy/vars/vars.tfvars". When I run the script, I get the following error:
invalid value "\"deploy/vars/vars.tfvars\"" for flag -var-file: Error reading "deploy/vars/vars.tfvars": open "deploy/vars/vars.tfvars": no such file or directory
However if I echo out the whole command:
echo terraform apply ${var_files} deploy/$1
I get:
terraform apply -var-file="deploy/vars/vars.tfvars" deploy/cluster
Which I can run manually from the terminal (in the same working directory that I'm running the script from) and it works just fine. What am I not understanding here?