Open buehlmann opened 1 month ago
Thanks for this feature request! If you are viewing this issue and would like to indicate your interest, please use the 👍 reaction on the issue description to upvote this issue. We also welcome additional use case descriptions. Thanks again!
Is this an enhancement or a bug? The documentation leads me to believe this should already work.
Mind linking the related documentation? I can follow-up from there.
Terraform Version
Use Cases
I would like to mock calculated attributes on resources in unit tests. By unit tests I mean the
command = plan
in the run blocks set, because I just want to test conditionals and loops inside my Terraform manifests. In the assert condition of the run block, it should be possible to use the mocked values on the resources.Attempted Solutions
The resource
gitlab_user_runner
exposes the computed attributetoken
, which I use as input for other resources. In my unit test I want to mock the value of this token.The main Terraform manifest:
Testfile where I want to override the token value on
gitlab_user_runner.test_runner
When executing the test, I get the following error:
When I run the test with command = plan everything works fine. But in this case I just want to have a unit test, without any resources provisioned.
Proposal
To write proper unit tests it would be a great benefit if one could supply mocked values already during the planning stage.
References
No response