Skip to content

New Code Action: Rename a block (+ generate moved block) #1567

Open
@radeksimko

Description

@radeksimko

Background

While prototyping new Terraform configuration, users may not always be careful in choosing the right names and need to change them later. This is not always a straight-forward process, especially if there is existing state involved.

Typically they expect to begin with

resource "aws_instance" "blablah" {
  // ...
}

and end up with

resource "aws_instance" "main" {
  // ...
}

moved {
  from = aws_instance.blablah
  to   = aws_instance.main
}

Proposal

  • Provide code actions to rename stateful blocks and (optionally?) generate moved {} block
    • Rename resource
    • Rename data
    • Rename module

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