Skip to content

New Code Action: Fix deprecated attribute/block #1538

Open
@radeksimko

Description

@radeksimko

Background

Currently we provide diagnostic warnings for deprecated attributes and blocks, such as in the example below.

validation-rule-deprecated-attribute

validation-rule-deprecated-block

While knowing that an attribute or a block is deprecated, it would be even more useful if the user could also easily address the deprecation. For example, if attribute foo is being replaced by another one called bar then it should be easy to rewrite the name.

Upstream blockers

The language server relies entirely on the machine-readable provider schema, which does not tell it anything else other that an attribute or a block is deprecated. Some provider maintainers may put further details in a human-readable form to attribute/block descriptions but that's about it.

In order for deprecations to become reliably fixable, there would need to be an agreed way of describing the nature of deprecations and communicating those in a machine-readably way between providers and the language server.

Proposal

  • Research common deprecation patterns (e.g. attribute renaming, type change, ...)
  • Propose updates to provider framework/SDK
  • Figure out how those details can be communicated to the language server (if not via the existing machine-readable schema command in TF Core)
  • Implement code action which provides quickfix based on the data, e.g. renames an attribute from deprecated name to a new one

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions