Terraform test: assertions and provider boundaries
A configuration can be valid and still produce the wrong value. Test an observable requirement and include an input that would expose a plausible shortcut.
A module that must produce one service per region needs more than an assertion that its output is nonempty. Compare the expected keys, exact count and required values. Then test an empty input or an unexpected key if the module contract allows it.
The browser’s terraform test model evaluates a documented subset of assertions against planned values. It does not create test infrastructure or reproduce every feature of Terraform’s test runner. Passing a local assertion cannot establish real provider permissions, API behavior or service availability.
Provider mocking also has a boundary: a mock can isolate configuration logic, while a separate integration test checks the provider. Write down which dependency was replaced and which production behavior remains untested.
The official test reference describes the complete runner. Continue with custom conditions and provider-mocking concepts. Blocking input validation, check warnings and test failures have different effects; inspect the operation’s result instead of treating them as interchangeable.