Skip to content

Provider produced inconsistent result after apply: inconsistent values for sensitive attribute on indexer update #285

Description

@Josh-Archer

Description\nWhen updating an existing \prowlarr_indexer\ resource, Terraform throws the following error:\n\n\\nProvider produced inconsistent result after apply ... unexpected new value: .fields: inconsistent values for sensitive attribute.\n\\n\n### Root Cause\nThis occurs because the .fields\ array contains sensitive values (like API keys) and the provider's \Update\ and \Create\ methods overwrite the planned \Fields\ state with the API response via \indexer.write(ctx, response, &resp.Diagnostics). If the API normalizes a field, adds a new default field, or masks a sensitive attribute differently than the plan's exact state, Terraform detects state drift on a \Required\ attribute.\n\nSince \ ields\ is not marked \Computed: true, the provider is strictly forbidden by Terraform Plugin Framework from altering the planned fields during apply. Altering them results in the inconsistent result error, and because \ ields\ contains an attribute marked \Sensitive: true, Terraform obscures the specific diff and simply outputs \inconsistent values for sensitive attribute.\n\n### Fix\nThe fix is to align the \Fields\ state during \Create\ and \Update\ by preserving the \Fields\ from \

eq.Plan\ and restoring them after the \indexer.write\ call, ensuring the returned state exactly matches the plan for the non-computed \ ields\ set.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions