[英]Azure pipelines timing out when I add a variable group using msft-hosted agent deploying terraform code
When running Terraform in a pipeline you need to pass the parameter -input-false
.在管道中运行 Terraform 时,您需要传递参数-input-false
。 This will cause Terraform to immediately output the error and I suspect it's saying something like the input variable .net_name is not set
because you have not explained how you are joining the variable group to Terraform. It is not enough to simply add the pipeline variables, you must also pass them into Terraform.这将导致 Terraform 立即 output 错误,我怀疑它说the input variable .net_name is not set
,因为您没有解释如何将变量组加入 Terraform。仅添加管道变量是不够的,您还必须将它们传递给 Terraform。
There are a number of ways of passing values into Terraform as described in this page here: https://www.terraform.io/language/values/variables#assigning-values-to-root-module-variables如本页所述,有多种将值传递到 Terraform 的方法: https://www.terraform.io/language/values/variables#assigning-values-to-root-module-variables
The most common method I have seen used is to create an environment.tfvars
file.我见过最常用的方法是创建一个environment.tfvars
文件。 This is a simple key:pair value of variables which you can hard-code variables into which you then pass into Terraform like terraform apply -var-file="environment.tfvars"
这是一个简单的键:变量的对值,您可以将变量硬编码到其中,然后将其传递到 Terraform 中,例如terraform apply -var-file="environment.tfvars"
If you have values in Azure Pipelines that you want to place there, you can use the Azure Replace Tokens tasks.如果您在 Azure 管道中有要放置在那里的值,则可以使用 Azure 替换标记任务。 ( https://marketplace.visualstudio.com/items?itemName=qetza.replacetokens ) ( https://marketplace.visualstudio.com/items?itemName=qetza.replacetokens )
In which case your environment.tfvars
will look like this:在这种情况下,您的environment.tfvars
将如下所示:
vnet_name = #{vnet_name}#
The Replace Token Task will replace the Azure Pipeline variable .net_name
with the value described in your variable group.替换令牌任务会将 Azure 管道变量.net_name
替换为变量组中描述的值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.