我正在尝试运行以下几行shell脚本:
var_files=$(var_file_selector)
echo ${var_files}
terraform apply ${var_files} deploy/$1
其中var_files解析为“ deploy / vars / vars.tfvars”。运行脚本时,出现以下错误:
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
但是如果我回显整个命令:
echo terraform apply ${var_files} deploy/$1
我得到:
terraform apply -var-file="deploy/vars/vars.tfvars" deploy/cluster
我可以在终端上手动运行(在与运行脚本相同的工作目录中),它可以正常工作。我在这里不明白什么?