Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Warning Option to Terraform Test #36697

Open
canuski opened this issue Mar 14, 2025 · 1 comment
Open

Add Warning Option to Terraform Test #36697

canuski opened this issue Mar 14, 2025 · 1 comment
Labels
enhancement new new issue not yet triaged terraform test

Comments

@canuski
Copy link

canuski commented Mar 14, 2025

Terraform Version

Terraform v1.11.1
on windows_amd64

Use Cases

Right now the test framework throws an error for every failed assertion. That’s usually fine, but sometimes it’s a problem because it interrupts our pipeline or workflow. Sometimes we just want to get a warning instead, so we know something’s off without completely breaking the flow, or if it's just a minor error.

For example, we have a policy where VMs aren’t supposed to have HDDs, so we wrote a test for that. But sometimes we actually need to check if the HDD works or there’s a specific reason we need to use one. In those cases, it would be way better if the test just logged a warning instead of causing the whole pipeline to fail, our devs could see the warning and choose to ignore it, or choose to take action.

Benefits

  • makes test outcomes more flexible.
  • helps separate critical errors from minor warnings.

Attempted Solutions

Right now there’s no way to do this. If an assertion fails, it always throws an error.

Proposal

Add an option to mark an assertion as a warning instead of an error. Maybe something like this:
result_type = warning
It could work similar to how the command option is used.

References

No response

@canuski canuski added enhancement new new issue not yet triaged labels Mar 14, 2025
@crw
Copy link
Contributor

crw commented Mar 17, 2025

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement new new issue not yet triaged terraform test
Projects
None yet
Development

No branches or pull requests

3 participants