• Alisdair McDiarmid's avatar
    jsonplan: Improve performance for deep objects · 3e4d6b25
    Alisdair McDiarmid authored
    When calculating the unknown values for JSON plan output, we would
    previously recursively call the `unknownAsBool` function on the current
    sub-tree twice, if any values were unknown. This was wasteful, but not
    noticeable for normal Terraform resource shapes.
    
    However for deeper nested object values, such as Kubernetes manifests,
    this was a severe performance problem, causing `terraform show -json` to
    take several hours to render a plan.
    
    This commit reuses the already calculated unknown value for the subtree,
    and adds benchmark coverage to demonstrate the improvement.
    3e4d6b25