【问题标题】:Terratest Azure how to use -auto-approve -input=falseTerratest Azure 如何使用 -auto-approve -input=false
【发布时间】:2020-10-31 07:49:59
【问题描述】:

感谢您在 terratest 所做的出色工作。

我正在使用 terratest 来测试 Azure 部署。

这是我必须应用 terraform 的命令,我正在尝试从 terratest 实现相同的目标

terraform apply -no-color -auto-approve -input=false -var-file "../environments/env/shared.tfvars" -var-file "../environments/env/cont_reg.tfvars" 

这是我来自 sample_test.go 的代码:

    terraformOptions := &terraform.Options{
        TerraformDir: "../scripts",
        NoColor: true,
        BackendConfig: map[string]interface{}{
            "storage_account_name": storageactname,
            "key": fname,
        },

如何实现 terratest apply 中的 -auto-approve-input=false 部分? 注意:我可以使用-no-colorNoColor: true,但不确定如何使用-auto-approve-input=false

【问题讨论】:

    标签: azure terraform terratest


    【解决方案1】:

    terratest 可以指定Options。这包括NoColor。不包含-auto-approve,但包含的EnvVars 可以使用terraform TF_CLI_ARGS 环境变量来指定-auto-approve 选项。

    【讨论】:

      猜你喜欢
      • 2021-08-01
      • 2021-09-23
      • 1970-01-01
      • 2023-03-11
      • 2021-01-13
      • 1970-01-01
      • 2023-03-10
      • 2018-04-11
      • 2023-04-10
      相关资源
      最近更新 更多