-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Open
Labels
Description
Terraform Version
Actual code
Terraform v1.9.4
on darwin_arm64
+ provider registry.terraform.io/hashicorp/aws v5.63.0
Minimal Example
Terraform v1.9.4
on darwin_arm64
+ provider registry.terraform.io/hashicorp/aws v5.74.0Terraform Configuration Files
main.tf:
variable "batch_exec_role_name" {
type = string
}
data "aws_iam_role" "batch_exec_role" {
name = var.batch_exec_role_name
}
# ...main.tftest.hcl:
variables {
some_other_var = "some_val"
}
run "invalid_role_name" {
variables {
batch_exec_role_name = "does-not-exist"
}
expect_failures = [
data.aws_iam_role.batch_exec_role,
]
command = plan
}Debug Output
https://gist.github.com/mgrubb/ba584b36173af380a9c0c8ea191e7beb
Expected Behavior
Test should pass by noting the data resource was not found and caused an error
Actual Behavior
Test fails by missing not finding the failure caused by the missing data resource.
Steps to Reproduce
terraform initterraform test
Additional Context
using expect_failures = [var.some_var] for detecting variables that do not pass validation rules works as expected.
I also tried adding a postcondition to the data resource with a condition of self.name == var.batch_exec_role_name but that didn't seem to have any impact.
References
No response
bebold-jhr and edgetools