← IaC Academy

Files and artifacts · 14 / 23

Convert and encode structured values

Build a typed object, serialize it, then extract its text for a string field.

YOUR TASK

Make this happen

3 steps
  1. Convert "3" with number() and "true" with bool().

  2. Keep the tags list and quoted "display-name" key.

  3. Use source(jsonencode(...)) for the description.

Read the starter files

main.cococo

team "fulfillment" {
  name = "Fulfillment"
  description = source(jsonencode({
    retries = number("3")
    enabled = bool("false")
    tags = ["packing", "shipping"]
    "display-name" = "Fulfillment"
  }))
}