Use a local instead, like:

variable "AutoStopSchedule" { default = "5" } locals{ schedule_expression= "cron(${var.AutoStopSchedule} * * * ? *)" } output "schedule_expression" { value = "${local.schedule_expression}" }

If you terraform apply you get the following:

Apply complete! Resources: 0 added, 0 changed, 0 destroyed. Outputs: schedule_expression = cron(5 * * * ? *)
To use it ${local.sschedule_expression} where you had ${var.schedule_expression} before.

Support On Demand!

Cloud