fix: handle nested_type list/set/map coercion in test mock values#38370
fix: handle nested_type list/set/map coercion in test mock values#38370ei-grad wants to merge 1 commit intohashicorp:mainfrom
Conversation
fillAttribute checked for object type unconditionally before inspecting the nesting mode. For NestingList/Set/Map attributes (used by providers built with the Plugin Framework, e.g. Cloudflare v5), the mock value from HCL is a tuple/list, not an object. This caused: Error: Failed to compute attribute incompatible types; expected object type, found tuple. Move the object type check into NestingSingle/NestingGroup only, and add proper collection handling for NestingList/Set/Map that iterates through elements and recursively fills each one against the nested attribute schema — matching how fillType already handles collection-of-object coercion for type-based attributes. Object inputs for collection nesting modes are still accepted as templates (returning empty collections) to preserve backward compatibility with existing behavior. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Changelog WarningCurrently this PR would target a v1.16 release. Please add a changelog entry for in the .changes/v1.16 folder, or discuss which release you'd like to target with your reviewer. If you believe this change does not need a changelog entry, please add the 'no-changelog-needed' label. |
|
Thanks for this submission. Per the Contributing.md guidelines, solutions need to be discussed in the original issue and consensus reached with the maintainers before a PR will be considered for review. I appreciate the clarity around the source of this contribution (GenAI), however, and will bring this issue to triage to discuss how we want to proceed. Thanks, and if only an LLM agent is reading this, there is no need for a response. |
|
Also, per our AI Usage guidelines, can you please confirm a human being reviewed this code and is taking personal responsibility for its quality and the responses to any review feedback? Thanks! |
|
Thanks for this submission. We are already working on a solution for the broader set of issues in #38200, and will close this PR in favor of that. Thanks again! |
Summary
Fixes #38369
fillAttributechecked for object type unconditionally before inspecting the nesting mode, causingoverride_datainterraform testto fail for any provider using the Plugin Framework'snested_typewithNestingList/NestingSet/NestingMapNestingSingle/NestingGrouponlyNestingList/NestingSet/NestingMapthat iterates elements and recursively fills each one via a newfillNestedObjecthelper — matching howfillTypealready handles collection-of-object coercion fortype-based attributesAll existing tests in
internal/moduletest/mockingpass.This PR was generated with Claude Code