Skip to content

tfsdk: Allow GetAttribute To Return Unknown Values Instead Of Null When Missing Due To Parent Being Unknown #186

Open
@bflad

Description

@bflad

Module version

v0.4.2

Use-cases

As part of fixing #150, the GetAttribute() method on Config, Plan, and State will skip tftypes.ErrInvalidStep errors and instead return null values when valid, but missing. A related case of this behavior that might be useful for functionality such as plan modifiers and validation is knowing whether the value is instead unknown, which can happen if the value is missing from Config, Plan, or State because a parent path value is marked as unknown.

Attempted Solutions

Providers can verify if any parent paths are unknown, when a null value is returned. For example in attribute plan modifiers, the entire Config, Plan, or State value is available.

Proposal

Have the GetAttribute() method on Config, Plan, and State automatically perform the parent path checks for unknown. If found, return unknown value for type, otherwise continue returning null value for type.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    breaking-changeThis PR introduces a breaking change or the resolution of this issue may require a breaking change.enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions