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
I am currently working on a proof of concept tool that could help practitioners migrate their Terraform HCL configurations from null_resource resource blocks to terraform_data resource blocks (as well as adding moved blocks). Renaming the block types in-place works great, however similar functionality is not available for hclwrite.Attribute to update the attribute name in-place. Currently the workaround seems something like:
Description
I am currently working on a proof of concept tool that could help practitioners migrate their Terraform HCL configurations from
null_resource
resource blocks toterraform_data
resource blocks (as well as addingmoved
blocks). Renaming the block types in-place works great, however similar functionality is not available forhclwrite.Attribute
to update the attribute name in-place. Currently the workaround seems something like:However that will cause the attribute and its expression to be moved to the bottom of the same block, causing unnecessary configuration churn.
Proposal
Similar to the
(*hclwrite.Block).SetType()
method added in #340, create a new(*hclwrite.Attribute).SetName()
method, e.g.That only replaces the underlying
name
node in the AST. I have verified this locally and will submit the small addition for consideration. Thank you!The text was updated successfully, but these errors were encountered: