Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
4 tasks
radeksimko opened this issue Jan 5, 2024 · 4 comments
Open
4 tasks

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

radeksimko opened this issue Jan 5, 2024 · 4 comments
Labels

Comments

@radeksimko
Copy link
Member

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
@magodo
Copy link

magodo commented Sep 12, 2024

@radeksimko I'm interesting on this renaming feature. Do you have a plan about how to modify the TF files? E.g. currently looks like the only officially supported library to use is the hclwrite, however, it looks quite limited, and has even no support for the new attribute nested object in protov6. Or is there any other existing library I've missed?

@radeksimko
Copy link
Member Author

radeksimko commented Sep 13, 2024

@magodo I no longer actively work on this repository/team.

I am aware though that the rest of the team maintaining it had some plans for making it easier to add code actions in general. I don't know when this might be worked on though. I imagine they'd want to lay down some foundations first before adding (more) individual code actions, partially to also avoid having every code action "invent solutions" for the exact problems you mentioned.

@jpogran
Copy link
Contributor

jpogran commented Sep 13, 2024

Hi @magodo, we have not planned out this feature yet. We often put up tickets with our current ideas about new features for comment/feedback without a set timeline to implement. At this time we do not have any ETA for you, are you looking to contribute to this extension?

@magodo
Copy link

magodo commented Sep 14, 2024

Thank you @radeksimko and @jpogran for the quick replies! Re @jpogran, I'm not directly contributing to this project, but if there is anything out of what I'm gonna work on that is valuable to contribute back here, I'll definitely make a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants