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

Support for provisioners in removed blocks #35230

Merged
merged 3 commits into from
May 23, 2024
Merged

Commits on May 21, 2024

  1. configs: Provisioners in "removed" blocks

    When the removed_provisioners experiment is active, removed blocks
    referring to managed resources are allowed to include "connection" and
    "provisioner" blocks, as long as all of the "provisioner" blocks specify
    when = destroy to indicate that they should execute as part of the
    resource's "destroy" action.
    
    This commit only deals with parsing the configuration. The logic to react
    to this during the apply phase will follow in later commits.
    apparentlymart authored and jbardin committed May 21, 2024
    Configuration menu
    Copy the full SHA
    5e545ff View commit details
    Browse the repository at this point in the history
  2. terraform: Basic support for provisioners in "removed" blocks

    During the apply phase, we'll check if there are provisioners either in
    the matching "resource" block or the matching "removed" block -- whichever
    of the two is present -- and execute the destroy-time subset of them
    either way.
    
    This also establishes a standard way to attach a "removed" block to a
    NodeResourceAbstract when one is defined, which is likely to be useful
    for supporting other resource-related meta arguments in "removed" blocks
    in future.
    
    One known limitation and design question from this initial implementation
    is: how should each.key, each.value, and count.index behave when used as
    part of a provisioner configuration in a "removed" block? This is a tricky
    question because whereas a "resource" block allows us to determine from
    the configuration whether we're using count, for_each, or neither, removed
    blocks must accept whatever happens to be in the state and so in unusual
    cases there might even be a mixture of numeric instance keys and string
    instance keys for the same resource, making it impossible to write a
    provisioner configuration that would work with both.
    apparentlymart authored and jbardin committed May 21, 2024
    Configuration menu
    Copy the full SHA
    1b9c0cb View commit details
    Browse the repository at this point in the history

Commits on May 22, 2024

  1. use try() in removed provisioner test

    This records in a test that both `count.index` and `each.key` will
    validate properly within a `removed` block provisioner.
    jbardin committed May 22, 2024
    Configuration menu
    Copy the full SHA
    ddd7ddd View commit details
    Browse the repository at this point in the history