在运行terraform或terraform计划时,是否有任何方法(或解决方法)指定工作目录?例如:
terraform apply working_dir/vpc
terraform apply working_dir/dns
terraform apply working_dir/postgres
terraform apply working_dir/service-a
terraform apply working_dir/service-b我知道有一个目标选项,我们可以为目标指定资源。但在这里,我需要一个文件夹来进行更多的抽象。最终目标是能够设置运行以下命令的基础设施:
make vpc
make dns
make postgres
make service-a
make service-b发布于 2021-04-06 11:32:36
现在,您还可以使用全局选项-chdir。
chdir选项指示Terraform在运行给定的子命令之前将其工作目录更改为给定目录。这意味着Terraform通常在当前工作目录中读取或写入的任何文件都将被读写到给定的目录中。
例如:
terraform -chdir=environments/production apply发布于 2018-03-21 23:57:22
您可以在发出apply命令时指定计划或目录。您的示例是有效的应用命令。
用法: terraform应用选项
发布于 2019-12-31 19:00:45
从包含terraform (*.tf)文件的多个目录的父目录执行以下命令。
执行地形:
terraform init dir-name
terraform validate dir-name
terraform plan -detailed-exitcode -out=plan-name.out dir-name
terraform apply plan-name.out销毁使用:
terraform destroy dir-namehttps://stackoverflow.com/questions/48958462
复制相似问题