terraform_test

Rules

terraform_test

load("@rules_terraform//terraform:terraform_test.bzl", "terraform_test")

terraform_test(name, lock, root)

Runs terraform's native HCL test framework (terraform test) on the root module as a Bazel test. Test cases live in .tftest.hcl files. Fully hermetic — the .terraform directory is assembled by the init aspect from Bazel-managed deps.

Bazel --test_arg values are intentionally ignored so the surface stays predictable — every run executes the module's .tftest.hcl files.

ATTRIBUTES

NameDescriptionTypeMandatoryDefault
nameA unique name for this target.Namerequired
lockAn optional .terraform.lock.hcl file.LabeloptionalNone
rootThe terraform_module target that serves as the root module.Labelrequired