github.com/muratcelep/terraform@v1.1.0-beta2-not-internal-4/website/docs/cli/state/move.html.md (about)

     1  ---
     2  layout: "docs"
     3  page_title: "Moving Resources - Terraform CLI"
     4  description: "Commands that allow you to manage the way that resources are tracked in state. They are helpful when you move or change resources."
     5  ---
     6  
     7  # Moving Resources
     8  
     9  Terraform's state associates each real-world object with a configured resource
    10  at a specific [resource address](/docs/cli/state/resource-addressing.html). This
    11  is seamless when changing a resource's attributes, but Terraform will lose track
    12  of a resource if you change its name, move it to a different module, or change
    13  its provider.
    14  
    15  Usually that's fine: Terraform will destroy the old resource, replace it with a
    16  new one (using the new resource address), and update any resources that rely on
    17  its attributes.
    18  
    19  In cases where it's important to preserve an existing infrastructure object, you
    20  can explicitly tell Terraform to associate it with a different configured
    21  resource.
    22  
    23  - [The `terraform state mv` command](/docs/cli/commands/state/mv.html) changes
    24    which resource address in your configuration is associated with a particular
    25    real-world object. Use this to preserve an object when renaming a resource, or
    26    when moving a resource into or out of a child module.
    27  
    28  - [The `terraform state rm` command](/docs/cli/commands/state/rm.html) tells
    29    Terraform to stop managing a resource as part of the current working directory
    30    and workspace, _without_ destroying the corresponding real-world object. (You
    31    can later use `terraform import` to start managing that resource in a
    32    different workspace or a different Terraform configuration.)
    33  
    34  - [The `terraform state replace-provider` command](/docs/cli/commands/state/replace-provider.html)
    35    transfers existing resources to a new provider without requiring them to be
    36    re-created.