You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mocking can be very helpful and powerful when testing. In addition to the request to allow for mocking providers in tests, we should also be able to create more granular mocks, for specific resources / modules / data sources
Attempted Solutions
No way currently to mock specific resources / modules / data sources in test runs
Proposal
Create override_module, override_resource and override_data blocks, which could be defined globally in the test file / under the mock_provider block / under a run block, and could be used to completely override the module/resource/data source.
When using an override_module/override_resource/override_data, this module/resource/data wouldn't actually be created using the provider, it only immediately return with the values/outputs defined in the override block
cam72cam
added
accepted
This issue has been accepted for implementation.
and removed
pending-decision
This issue has not been accepted for implementation nor rejected. It's still open to discussion.
labels
Feb 1, 2024
OpenTofu Version
Use Cases
Mocking can be very helpful and powerful when testing. In addition to the request to allow for mocking providers in tests, we should also be able to create more granular mocks, for specific resources / modules / data sources
Attempted Solutions
No way currently to mock specific resources / modules / data sources in test runs
Proposal
Create
override_module
,override_resource
andoverride_data
blocks, which could be defined globally in the test file / under themock_provider
block / under arun
block, and could be used to completely override the module/resource/data source.When using an
override_module
/override_resource
/override_data
, this module/resource/data wouldn't actually be created using the provider, it only immediately return with thevalues
/outputs
defined in the override blockReferences
The text was updated successfully, but these errors were encountered: