Terraform: Providing list input values from command line?

Viewed 3755

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"

or possibly

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

If anyone came here trying to figure out why this doesn't work with terragrunt; you need to escape the quotes:

terragrunt apply -var 'listvar=[\"abc1\", \"abc2\", \"abc3\"]'
Related