variables.tf:
variable "host_os" {
type = string
}
For the next file, we will take the example of this EC2 instance provisioner main.tf. Modify line:
...
command = templatefile("linux-ssh-config.tpl", {
...
to:
...
command = templatefile("${var.host_os}-ssh-config.tpl", {
...
Now, run plan:
$ terraform plan
var.host_os
Enter a value: linux
...
To not to be asked each time - use this variables.tf with default set up:
variable "host_os" {
type = string
default = "linux"
}