Option to suppress output of data sources defined within check blocks during plans

We’re interesting in rolling out check blocks to verify various life states of our Kubernetes components. We’re considering using check blocks for this, with the data source kubernetes_resource to pull in life state.

This works well, except that the extremely large json object is printed during the plan for each of these data sources:

 # module.karpenter.data.kubernetes_resource.infra-spot will be read during apply
  # (config will be reloaded to verify a check block)
 <= data "kubernetes_resource" "infra-spot" {
      + api_version = "apps/v1"
      + kind        = "Deployment"
      + object      = {
          + apiVersion = "apps/v1"
          + kind       = "Deployment"
          + metadata   = {
              + annotations                = {
                  + "deployment.kubernetes.io/revision" = "1"
                  + "meta.helm.sh/release-name"         = "karpenter"```

This will become unusable if we add sufficient checks to cover the estate… is there a way to suppress this output from the plan?

Aha I’ve realised a simple workaround here is to pull the data source out of the check block - it can still refer to it when externally defined, and now doesn’t pollute the plans.

Others may disagree, but I’d suggest if it’s at all possible to manage Kubernetes resources from within Terraform as little as possible (for example, using them to bootstrap a system like Flux or ArgoCD).

The fact that the data source is shown because it needs to be reloaded later is an artifact of how the renderer was designed before checks existed. I don’t see any reason the output needs to be shown, and the fact that you can put a data source within the check block is really the primary reason for their existence at all!

I’ll file an enhancement request to take a look at changing the output.