You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While refactoring Terraform configuration, users may sometimes leverage local values to extract some computations and make parts of the configuration "dynamic". There are even apparently tools which generate locals entries according to some reports:
The common theme of ending up in a situation where local value is used as a variable is most likely just misunderstanding of the language features. We cannot naturally change external tooling but the server could make it easier to fix these mistakes in existing configuration.
Importantly we cannot tell whether a local variable was meant to be a variable as we don't have any context to decide or even guess that, we can give user the choice still though.
Proposal
Provide refactor.rewrite code action which turns existing local value into a variable
The text was updated successfully, but these errors were encountered:
Background
While refactoring Terraform configuration, users may sometimes leverage local values to extract some computations and make parts of the configuration "dynamic". There are even apparently tools which generate
locals
entries according to some reports:The common theme of ending up in a situation where local value is used as a variable is most likely just misunderstanding of the language features. We cannot naturally change external tooling but the server could make it easier to fix these mistakes in existing configuration.
For example, the user may begin with
and end with
Importantly we cannot tell whether a local variable was meant to be a variable as we don't have any context to decide or even guess that, we can give user the choice still though.
Proposal
refactor.rewrite
code action which turns existing local value into a variableThe text was updated successfully, but these errors were encountered: