Terraform:从命令行提供列表输入值? [英] Terraform: Providing list input values from command line?

查看:20
本文介绍了Terraform:从命令行提供列表输入值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法从命令行提供列表值?地图有变量合并,但它似乎不适用于列表.我希望有类似的东西,但没有运气......谢谢

Is there a way to provide list values from the command line? There is variable merging for maps, but it doesn't seem to be working for lists. I was hoping for something like, but no luck... Thanks

terraform apply -var "listvar=abc1" -var "listvar=abc2"

或者可能

terraform apply -var "listvar=[abc1, abc2]"

推荐答案

我能够让这个工作如下:

I was able to get this to work as follow:

1) 您的变量文件应反映如下:

1) Your variable file should reflect as follow:

 variable "listvar" {
      description = "some varaible to list"
      type = "list"
    }

2) 然后按如下方式运行apply命令:

2) Then run the apply command as exactly as follow:

terraform apply -var 'listvar=["abc1", "abc2", "abc3"]'

希望对你有帮助

https://www.terraform.io/intro/getting-started/variables.html

这篇关于Terraform:从命令行提供列表输入值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆