尝试使用azure devops管道构建AKS使用terraform,我希望我可以从prod_terraform传递变量值。tfvars文件我想运行"terraform plan -var-file = prod_terraform.tfvars">
这里,是yaml代码
- task: TerraformCLI@0
displayName: Terraform Plan
inputs:
command: 'plan'
workingDirectory: '$(System.DefaultWorkingDirectory)/terraform-manifests'
commandOptions: '-out aks_cluster.tfplan'
allowTelemetryCollection: false
下面是错误
/opt/hostedtoolcache/terraform/1.0.8/x64/terraform plan -out aks_cluster.tfplan
Acquiring state lock. This may take a few moments...
var.acr_demo
Enter a value:
##[error]The operation was canceled.
Finishing: Terraform Plan
Terraform将自动从变量定义文件中加载变量值,如果它被命名为Terraform。以。auto开头或结尾。与其他配置文件放在相同的目录中,如下所示:
development
└── server
└── main.tf
└── variables.tf
└── terraform.tfvars
我重命名了文件,它工作了