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
Dynamically enable/disable check blocks #35081
Comments
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! |
Hi @tomhaynes, I don't mean the following as any statement about specifically what you requested -- it's still an open feature request ready for consideration -- but I wanted to share a way you could approximate this in today's Terraform. One current possibility is to place the entire module "checks" {
count = /* whatever rule you have to choose whether to check or not */ ? 1 : 0
# (and then any arguments needed to pass data into
# the nested check blocks.)
} Terraform Core treats The feature request in this issue would avoid the need for that extra level of indirection, but I think it would otherwise be treated in just the same way by Terraform Core, just with some more complicated logic for deciding which instances of the check block are declared. One potential implementation complexity is that |
Many thanks for your quick reply @apparentlymart, that does sound like it would work - though as you say slightly more cumbersome. Is it possible to link to the existing feature request for the meta-arguments? In the meantime we'll have a go with wrapping in a submodule. Thanks again! |
@apparentlymart confirm your suggestion works well thanks! It might be worth adding that as an option to the docs here - as that's what led me to raising the request. I think I misread you're initial reply in thinking there is a separate open request for the meta-argument support. I'm happy to leave this open if its useful, we'll carry on with the submodule for now. |
Indeed, as far as I know this is the only issue discussing the idea of check blocks alone being dynamically disabled, so I think leaving it open makes sense. My reply was only intended as a possible alternative you could use immediately, so you wouldn't be completely blocked. |
A correction on what I said in an earlier comment: Currently In particular, the absolute address of a |
Terraform Version
Use Cases
We are currently looking at rolling out automated integration testing, hopefully involving the use of check blocks. To ease roll-out and adoption across our shared modules it would be very useful to support flagging these on/off via
count/for_each
.We also see use-cases whereby our modules provide a set of default checks that can be tailored or extended by specific implementation - again this would naturally fit the use of
for_each
Attempted Solutions
We're currently trying to use just external data sources, but as these are smoke tests they would be better implemented with the check blocks.
Proposal
No response
References
No response
The text was updated successfully, but these errors were encountered: