1. A developer writes the following locals block: ```hcl locals { env = "prod" prefix = "myapp" bucket_name = format("%s-%s-%s", local.prefix, local.env, "assets") } ``` What will `local.bucket_name` evaluate to?
- A. "myapp-prod-assets"✓ Correct
- B. "myapp_prod_assets"
- C. "%s-%s-%s"
- D. An error, because `local` values cannot reference other `local` values inside the same block.
Explanation
Option A is correct: `format("%s-%s-%s", "myapp", "prod", "assets")` substitutes each `%s` placeholder with the corresponding argument separated by `-`, producing `"myapp-prod-assets"`. Option B is wrong: the format string uses `-` as a separator, not `_`. The result uses dashes. Option C is wrong: `%s` placeholders in `format()` are replaced with the provided arguments; the format string itself is never returned as-is. Option D is wrong: Terraform fully supports cross-referencing local values within the same module (even within the same `locals` block). Terraform resolves them in dependency order.