#til

printf-style format is also available in terraform:
`format("vm%d-disk%d", 0, 3)` produces `vm0-disk3`

You can test it in the terraform "repl":

```
$ terraform console
> format("vm%d-disk%d", 0, 3)
"vm0-disk3"
> format("%02d", 1)
"01"
```

https://developer.hashicorp.com/terraform/language/functions/format

#terraform #iac

format - Functions - Configuration Language | Terraform | HashiCorp Developer

The format function produces a string by formatting a number of other values according to a specification string.

format - Functions - Configuration Language | Terraform | HashiCorp Developer

In #Bicep, the `format()` function uses .NET-style placeholders instead of `%d`.
It is a little easier to read imho:

```
// vm0-disk3
format('vm{0}-disk{1}', 0, 3)
// 01
format('{0:D2}', 1)
```

Unfortunately (and unlike #terraform), bicep does not come with a console, so "quick" tests come with an overhead of creating a dummy file with just the relevant outputs and deploying it:

```
output format_1 string = format('vm{0}-disk{1}', 0, 3)
output format_2 string = format('{0:D2}', 1)
```