Exercise 3: What count Evaluates To in the "staging" Workspace — Possible Solution ==================================================================== `count` evaluates to 1 while the "staging" workspace is selected. The expression `terraform.workspace == "prod" ? 3 : 1` is a simple two-way ternary: it checks ONE specific condition (is the current workspace exactly equal to the string "prod"?) and has exactly two possible outcomes -- 3 if that condition is true, 1 for literally EVERY other case, with no distinction made between them. "staging" is not equal to "prod," so the condition evaluates to false, and the expression falls through to the else-branch value of 1 -- functionally identical, from this expression's point of view, to how "dev" would also evaluate to 1. This is a genuine, worth-noticing gotcha: the ternary was written with only two environments in mind (implicitly, "prod" and "everything else"), but the moment a third workspace like "staging" is introduced, it silently gets grouped into the same "everything else" bucket as "dev" -- getting `count = 1`, the same as dev, even if the team's actual intent was for staging to have its own distinct value (say, 2) somewhere between dev's 1 and prod's 3. Nothing about running `plan` or `apply` in the staging workspace would surface this as an error; the configuration is perfectly valid HCL and produces a perfectly well-formed plan -- it just silently doesn't do what a naive reading of "we have three environments now" might assume. The fix, if staging genuinely needs its own value, would be to replace the two-way ternary with something that maps each workspace name to its own value explicitly -- e.g. a lookup map keyed by `terraform.workspace`, with a value defined for every environment rather than an implicit "everything that isn't prod" bucket. WHY THIS WORKS AS AN ANSWER ------------------------------ This gives the correct evaluated value (1) with the precise reasoning (a two-way ternary has no notion of a third case), and goes further to name the underlying real-world risk -- a new environment silently inheriting an unrelated environment's behavior -- rather than treating the question as pure syntax trivia.