Country or region and language

    Choose your country or region and your language.

    Suggested for you

      All countries and regions

        Choose your character

        It shows in the top bar and on your profile. Change it any time.

        Terraform course

        Moved blocks

        Opening Terraform
        Your turn

        Terraform moved block: address changes and identity

        Renaming a resource label changes its Terraform address. Without a mapping, Terraform can interpret that edit as an old resource removed and a new resource added.

        moved {
          from = lab_server.api
          to   = lab_server.dispatch
        }

        This original example tells the course model how the previous address relates to the new one. Keep the resource’s provider identity and review the plan. A state move does not rename the physical provider object. Changing an immutable provider argument at the same time can still require replacement.

        A declarative moved block records the mapping for collaborators who apply the configuration later. An imperative terraform state mv changes a particular state immediately. Their operational timing differs, so coordinate state writers and retain a recovery record before manual state work.

        The official refactoring guide explains address moves. Practice state inspection and import to distinguish an existing binding from adoption of an unmanaged object.

        Your Work Gym account

        Save your progress and pick up on another device. Your browser's progress comes with you.

        or

        You can keep practicing without an account.

        Change your plan

        Checking the price

        Help and feedback

        Ask a question, tell us what is not working, or share an idea. We reply by email.

        What is it about?

        We use it only to reply to you.