I want to know the way to separate terraform expressions into multiple lines because they're sometimes too long if in 1 line.
- terraform's version I use
$ terraform version
Terraform v0.14.2
- long expression example : If the bucket name is not specified, create a new bucket name. If specified, use it.
locals {
bucket_name = var.bucket_name == "" ? "hoge-${formatdate("YYYYMMDDHHmmss", timestamp())}" : var.bucket_name
}
- I want to change the example expression like below
locals {
bucket_name = var.bucket_name == "" ? \
"hoge-${formatdate("YYYYMMDDHHmmss", timestamp())}" : \
var.bucket_name
}
But this raise an Error: Invalid expression.
Is there any way to separate an expression into multiple lines?