concept

Mock providers and negative tests

Use expected failures and mock results to test module contracts.

Formal Syntax & Structure

terraform syntaxterraform
Mock providers and negative tests

Working Example

Example Snippetterraform
run "reject_zero" {  command = plan  variables {    replicas = 0  }  expect_failures = [var.replicas]}run "reject_fraction" {  command = plan  variables {    replicas = 1.5  }  expect_failures = [var.replicas]}
Terraform Reference
Mock providers and negative tests — Terraform | ByteMind