This topic provides reference information for the moved
block. Use this block to programmatically change the address of a resource. Refer to Refactoring for details about how to use the moved
block in your Terraform configurations.
The moved
block supports the following arguments:
The following moved
block defines all of the supported built-in arguments you can set:
moved {
from = <old address for the resource>
to = <new address for the resource>
}
A moved
block supports the following configuration.
moved
The moved
block specifies the previous address and the new address for the resource. The following table describes the arguments you can set in the moved
block.
from
Specifies a resource's previous address. The syntax allows Terraform to select modules, resources, and resources inside child modules. string required to
Specifies the new address to relocate the resource to. The syntax allows Terraform to select modules, resources, and resources inside child modules. string required
Before creating a new plan for the resource specified in the to
field, Terraform checks the state for an existing object at the address specified in the from
field. Terraform renames existing objects to the string specified in the to
field and then creates a plan. The plan directs Terraform to provision the resource specified in the from
field as the resource specified in the to
field. As a result, Terraform does not destroy the resource during the Terraform run.
The following example moves an AWS instance from address aws_instance.a
to aws_instance.b
:
moved {
from = aws_instance.a
to = aws_instance.b
}
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4