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

Include additional proposed change information for certain kinds of planning errors #34312

Merged
merged 2 commits into from
Nov 29, 2023

Commits on Nov 29, 2023

  1. core: NodeAbstraceResourceInstance.checkPreventDestroy returns diagno…

    …stics
    
    This method was returning diagnostics wrapped inside an error, and all
    of its callers were then immediately unwrapping it and using the
    diagnostics inside anyway.
    
    To make that clearer, we'll just return diagnostics directly.
    
    (It's likely that this was originally written as a function that returned
    an error before we even _had_ the concept of diagnostics, and over time
    we've gradually migrated all of the callers to be ready to accept
    diagnostics but neglected to actually update the function itself.)
    apparentlymart committed Nov 29, 2023
    Configuration menu
    Copy the full SHA
    b6fb2d5 View commit details
    Browse the repository at this point in the history
  2. core: Include some rejected changes in the plan

    Some time ago we ruled that Terraform Core would make a best effort to
    return a partial plan describing the subset of actions that were
    successfully proposed before encountering an error, which Terraform CLI
    and Terraform Cloud then rely on to present some additional context to
    support the associated error messages.
    
    This change aims to improve that effort by making a distinction between
    the failure of the planning operation itself vs. something else in the
    configuration ruling that the successfully-created plan is unacceptable
    for some separate reason.
    
    In that case, it's helpful to still include that proposed change in the
    plan, because the planning step itself succeeded and these problems are in
    a sense "between" the planning operations, blocking any downstream work
    from starting.
    
    In particular, this change arranges for a failed prevent_destroy check or
    a failed postcondition check to still include the planning result that
    they were checked against, which then allows the UI the option of
    displaying that planned action alongside the error describing why it was
    unacceptable.
    
    This doesn't include any Terraform CLI UI changes, but the UI layer is
    already built to show partial plans returned alongside errors and so as
    of this change the additional planned changes are already included. It'll
    be up to future maintainers of Terraform CLI to decide whether and how
    to refine that output, but the existing behavior is sufficient for now.
    apparentlymart committed Nov 29, 2023
    Configuration menu
    Copy the full SHA
    04ba647 View commit details
    Browse the repository at this point in the history