简体   繁体   English

当我使用部署 terraform 代码的 msft 托管代理添加变量组时,Azure 管道超时

[英]Azure pipelines timing out when I add a variable group using msft-hosted agent deploying terraform code

My Azure pipeline is timing out on terraform plan/apply when I add variable groups.当我添加变量组时,我的 Azure 管道在 terraform 计划/应用上超时。

The variables变量

Variable group变量组

I tried to do some research but to no avail.我试图做一些研究,但无济于事。

yml yml

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.

相关问题 Terraform:模块的output变量到azure-pipelines.yml文件 - Terraform: Module's output variable to azure-pipelines.yml file 在使用 terraform 部署脚本以启用 Azure 数据工厂中的客户管理密钥时,我收到一个错误,我在下面说明了这一点 - On deploying Script to enable Customer Managed Key in Azure Data Factory using terraform, I am getting an error which I have stated below terraform 想在我只想向安全组添加规则时替换 ec2 实例 - terraform wants to replace ec2 instances when i simply want to add a rule to a security group 将 ARM 模板部署到 Azure 资源组时出现授权错误 - Authorisation errors when deploying ARM templates to Azure Resource Group 使用 Terraform 为 Azure 数据工厂管道创建数组变量或参数 - Creating Array Variable or Parameters For Azure Data Factory Pipeline Using Terraform Azure 管道 terraform init -backend-config 抛出退出代码 127 - Azure Pipelines terraform init -backend-config throwing exit code 127 azure 自托管代理的资源限制 - Resource limit on azure self hosted agent 我在 ADO 管道中使用 Azure Bicep 生成了资源。 需要创建一个新的管道,用代码填充资源。 不确定如何 - I've generated resources using Azure Bicep in ADO pipelines. Need to make a new pipeline that will populate the resources with code. Not sure how 使用 terraform 部署 EKS 节点组时出错 - Error deploying EKS node-group with terraform 如何将 Terraform 中的逻辑用于 Azure? - How can i use logic in Terraform for Azure?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM