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

Ensure consistency of details and tallies in plan and apply #15884

Merged
merged 7 commits into from
Sep 2, 2017

Commits on Aug 31, 2017

  1. core: stabilize ResourceAddress.Less results

    The implementation of ResourceAddress.Less was flawed because it was only
    testing each field in the "less than" direction, and falling through in
    cases where an earlier field compared greater than a later one.
    
    Now we test for inequality first as the selector, and only fall through
    if the two values for a given field are equal.
    apparentlymart committed Aug 31, 2017
    Configuration menu
    Copy the full SHA
    ac16c12 View commit details
    Browse the repository at this point in the history
  2. command/format: improve consistency of plan results

    Previously the rendered plan output was constructed directly from the
    core plan and then annotated with counts derived from the count hook.
    At various places we applied little adjustments to deal with the fact that
    the user-facing diff model is not identical to the internal diff model,
    including the special handling of data source reads and destroys. Since
    this logic was just muddled into the rendering code, it behaved
    inconsistently with the tally of adds, updates and deletes.
    
    This change reworks the plan formatter so that it happens in two stages:
    - First, we produce a specialized Plan object that is tailored for use
      in the UI. This applies all the relevant logic to transform the
      physical model into the user model.
    - Second, we do a straightforward visual rendering of the display-oriented
      plan object.
    
    For the moment this is slightly overkill since there's only one rendering
    path, but it does give us the benefit of letting the counts be derived
    from the same data as the full detailed diff, ensuring that they'll stay
    consistent.
    
    Later we may choose to have other UIs for plans, such as a
    machine-readable output intended to drive a web UI. In that case, we'd
    want the web UI to consume a serialization of the _display-oriented_ plan
    so that it doesn't need to re-implement all of these UI special cases.
    
    This introduces to core a new diff action type for "refresh". Currently
    this is used _only_ in the UI layer, to represent data source reads.
    Later it would be good to use this type for the core diff as well, to
    improve consistency, but that is left for another day to keep this change
    focused on the UI.
    apparentlymart committed Aug 31, 2017
    Configuration menu
    Copy the full SHA
    f1807a7 View commit details
    Browse the repository at this point in the history

Commits on Sep 1, 2017

  1. command: show resource actions using resource addresses

    Previously we were using the internal resource id syntax in the UI. Now
    we'll use the standard user-facing resource address syntax instead.
    apparentlymart committed Sep 1, 2017
    Configuration menu
    Copy the full SHA
    d09b4a0 View commit details
    Browse the repository at this point in the history
  2. core: don't advertise data source destroy via hooks

    The fact that we clean up data source state by applying a "destroy" action
    for them is an implementation detail, and so should not be visible to
    outside callers or to the user.
    
    Signalling these as real destroys creates confusion for users because
    they see Terraform say things like:
    
        data.template_file.foo: Refreshing state..."
    
    ...which, to an understandably-nervous sysadmin, might make them suspect
    that the underlying object was deleted, rather than just Terraform's
    record of it.
    apparentlymart committed Sep 1, 2017
    Configuration menu
    Copy the full SHA
    09a4219 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    0dcdb94 View commit details
    Browse the repository at this point in the history
  4. core: test that we skip hooks for data source destroy

    Data source destroy is an implementation detail and not something that
    external callers should see or expect.
    apparentlymart committed Sep 1, 2017
    Configuration menu
    Copy the full SHA
    f7125b3 View commit details
    Browse the repository at this point in the history
  5. command: various adjustments to the diff presentation

    The previous diff presentation was rather "wordy", and not very friendly
    to those who can't see color either because they have color-blindness or
    because they don't have a color-supporting terminal.
    
    This new presentation uses the actual symbols used in the plan output
    and tries to be more concise. It also uses some framing characters to
    try to separate the different stages of "terraform plan" to make it
    easier to visually navigate.
    
    The apply command also adopts this new plan presentation, in preparation
    for "terraform apply" (with interactive plan confirmation) becoming the
    primary, safe workflow in the next major release.
    
    Finally, we standardize on the terminology "perform" and "actions" rather
    than "execute" and "changes" to reflect the fact that reading is now an
    action and that isn't actually a _change_.
    apparentlymart committed Sep 1, 2017
    Configuration menu
    Copy the full SHA
    cbbcce8 View commit details
    Browse the repository at this point in the history