A module test must fail with a message that tells the reader exactly what went wrong when the module's endpoint_url output does not start with https. What belongs inside the run block in the .tftest.hcl file?
Select an answer to reveal the explanation.
Short Explanation
In a test file, assert is your umpire. You give it a condition and a message, and when the condition comes out false the run fails and your message tells everyone why.
Full Explanation
Within a .tftest.hcl file, run blocks contain assert blocks, and each assert block has a condition and an error_message. After the run's command completes, Terraform evaluates each condition against the resulting state or plan, including module outputs, and if a condition is false it fails the run and prints the error_message. Testing the endpoint_url output with a string function, such as checking that it starts with https, therefore produces exactly the clear failure the maintainer wants, and Terraform presents every failed assertion in the test results. Check blocks belong in ordinary Terraform configuration, where they report warnings during plan and apply; they are not the assertion mechanism of the test framework. Validation blocks belong inside variable blocks and validate input values, not test results. Postcondition blocks live in the lifecycle of resources and data sources, or as preconditions on outputs, inside the module configuration; adding such conditions changes the module itself rather than expressing a test expectation. Exam caveat: when a run is expected to fail a module's own validation or custom condition, use expect_failures instead of an assert block. Operational check: temporarily break the output in a branch, run terraform test, and confirm the run fails with the custom message.