A module defines local.name = coalesce(var.override_name, var.default_name) with override_name = null and default_name = "web", and local.port = try(local.config.port, 8080), where local.config is yamldecode() of a file that has no port key. What are the two values?
Select an answer to reveal the explanation.
Short Explanation
coalesce() is the friend who skips the empty chairs and grabs the first person actually sitting down. try() is your safety net: if the first expression falls over, it catches you with the backup. The trap is thinking either function chokes on the very thing it's built to handle.
Full Explanation
coalesce() takes any number of arguments and returns the first one that is not null and not an empty string, so with override_name null it returns default_name, web. try() evaluates its argument expressions in order and returns the result of the first one that does not produce an error. Decoded YAML has a dynamic structure, so accessing a missing port attribute is an evaluation error at runtime, and try() catches it and returns 8080. Together the two functions implement the common pattern of an optional override with a fallback. coalesce does not simply return its first argument; skipping nulls is its defining purpose. Nor does it reject null arguments; it only errors when every argument is null or empty. try() is documented specifically for dynamic data such as decoded JSON or YAML, where an attribute may or may not exist. Exam caveat: try() catches only dynamic errors; it cannot hide errors in expressions that are invalid for any input, such as a reference to an undeclared resource, and HashiCorp recommends limiting it to normalizing data structures. Operational check: evaluate local.name and local.port in terraform console, then add a port key to the file and confirm the second value changes.