簡體   English   中英

當我使用部署 terraform 代碼的 msft 托管代理添加變量組時,Azure 管道超時

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

當我添加變量組時,我的 Azure 管道在 terraform 計划/應用上超時。

變量

變量組

我試圖做一些研究,但無濟於事。

yml

在管道中運行 Terraform 時,您需要傳遞參數-input-false 這將導致 Terraform 立即 output 錯誤,我懷疑它說the input variable .net_name is not set ,因為您沒有解釋如何將變量組加入 Terraform。僅添加管道變量是不夠的,您還必須將它們傳遞給 Terraform。

如本頁所述,有多種將值傳遞到 Terraform 的方法: https://www.terraform.io/language/values/variables#assigning-values-to-root-module-variables

我見過最常用的方法是創建一個environment.tfvars文件。 這是一個簡單的鍵:變量的對值,您可以將變量硬編碼到其中,然后將其傳遞到 Terraform 中,例如terraform apply -var-file="environment.tfvars"

如果您在 Azure 管道中有要放置在那里的值,則可以使用 Azure 替換標記任務。 ( https://marketplace.visualstudio.com/items?itemName=qetza.replacetokens )

在這種情況下,您的environment.tfvars將如下所示:

vnet_name = #{vnet_name}#

替換令牌任務會將 Azure 管道變量.net_name替換為變量組中描述的值。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM