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

fix invalid null blocks during refresh #32424

Merged
merged 3 commits into from Dec 21, 2022
Merged

Commits on Dec 21, 2022

  1. fix invalid null blocks during refresh

    Legacy providers may return null values for nested blocks during
    refresh. Because the ReadResource call needs to accept any value to
    allow the provider to report external changes, we allowed all changes to
    the value as long as the underlying cty.Type was correct, allowing
    null block values to be inserted into the state.
    
    While technically invalid, we needed to accept these null values for
    compatibility, and they were mostly seen as a nuisance, causing noise in
    external changes and plan output. These null block values however can be
    inserted into the effective configuration with the use of
    `ignore_changes`, which can cause problems where the configuration is
    assumed to be completely valid.
    
    Rather than accept the null values, we can insert empty container values
    for these blocks when refreshing the instance, which will prevent any
    invalid values from entering state at all. Because these must still be
    accepted for compatibility, we can only log the difference as a warning.
    Currently the NormalizeObjectFromLegacySDK does not report which
    specific blocks it fixed, so we just log a generic message.
    jbardin committed Dec 21, 2022
    Copy the full SHA
    0c1aaba View commit details
    Browse the repository at this point in the history
  2. fix test state

    jbardin committed Dec 21, 2022
    Copy the full SHA
    a6098b6 View commit details
    Browse the repository at this point in the history
  3. Copy the full SHA
    d493e99 View commit details
    Browse the repository at this point in the history