In my case, I needed to pass mutliple var options into a terraform plan command. On the command line, this may look like
terraform plan -var foo=bar -var bar=baz -var-file=variables.prod.tfvars
Or as described in the official documentation, it could be
terraform apply -var="image_id=ami-abc123"or
terraform apply -var='image_id_list=["ami-abc123","ami-def456"]' -var="instance_type=t2.micro"
There is even more documentation in order to make this thing work across different operating systems.
What struck me was apparently the whitespace between -var and the key value pair itself. Took me round about an hour to figure out this is the correct way to feed a command into a Gradle Exec task (Kotlin DSL ahead):
Mind that every var requires you to pass in an arg of -var and an arg of the key value pair itself.