opentofu
opentofu copied to clipboard
mock_provider still expects configuration attributes
OpenTofu Version
OpenTofu v1.8.2
OpenTofu Configuration Files
main.tf
terraform {
required_version = ">=1.5.0"
required_providers {
netbox = {
source = "e-breuninger/netbox"
version = "3.6.2"
}
}
}
variable "platform" {
description = "Device Platform"
type = string
default = "Linux"
}
data "netbox_platform" "default" {
name = var.platform
}
main.tftest.hcl
mock_provider "netbox" {}
run "netbox_platform" {
command = plan
variables {
platform = "tofutest"
}
assert {
condition = var.platform == "tofutest"
error_message = "Value is incorrect"
}
}
Debug Output
tofu test
main.tftest.hcl... fail
run "netbox_platform"... fail
╷
│ Error: Missing required attribute
│
│ on provider["registry.opentofu.org/e-breuninger/netbox"] with no configuration line 1:
│ (source code not available)
│
│ The attribute "api_token" is required, but no definition was found.
╵
╷
│ Error: Missing required attribute
│
│ on provider["registry.opentofu.org/e-breuninger/netbox"] with no configuration line 1:
│ (source code not available)
│
│ The attribute "server_url" is required, but no definition was found.
╵
Failure! 0 passed, 1 failed.
Expected Behavior
The test should pass. Terraform 1.9.6 is passing successfully.
Actual Behavior
Provider requires api_token and server_url configuration attributes. Can be set with NETBOX_API_TOKEN and NETBOX_SERVER_URL environment variables.
Steps to Reproduce
tofu test
Additional Context
No response
References
No response
Hello and thank you for the report! The core team regularly reviews new issues and discusses them, but this can take a little time. Please bear with us while we get to your issue. If you're interested, the contribution guide has a section about the decision-making process.
Thanks for the bug report! This issue is the same as #2139 and will be fixed by #2140.