$ tfenv install 1.1.7 Installing Terraform v1.1.7 Downloading release tarball from https://releases.hashicorp.com/terraform/1.1.7/terraform_1.1.7_darwin_amd64.zip ############################################################################################################################################################################################################# 100.0% Downloading SHA hash file from https://releases.hashicorp.com/terraform/1.1.7/terraform_1.1.7_SHA256SUMS No keybase install found, skipping OpenPGP signature verification Archive: /var/folders/0r/3y_v9zrd75n9dgv2f0cy6qq40000gn/T/tfenv_download.XXXXXX.qdVCVbhE/terraform_1.1.7_darwin_amd64.zip inflating: /Users/tanai3022/.anyenv/envs/tfenv/versions/1.1.7/terraform Installation of terraform v1.1.7 successful. To make this your default version, run 'tfenv use 1.1.7' $ tfenv use 1.1.7 Switching default version to v1.1.7 Switching completed $ terraform version Terraform v1.1.7 on darwin_amd64
moved { from = null_resource.resource_A to = null_resource.resource_X }
このタイミングで、すぐに terraform plan してみると…
$ terraform plan null_resource.resource_X: Refreshing state... [id=592263413744525319] null_resource.resource_B: Refreshing state... [id=5369048601034101090] null_resource.resource_C: Refreshing state... [id=3453046184153615927] ╷ │ Error: Moved object still exists │ │ on moved.tf line 1: │ 1: moved { │ │ This statement declares a move from null_resource.resource_A, but that resource is still declared at main.tf:1,1. │ │ Change your configuration so that this resource will be declared as null_resource.resource_X instead. ╵
Terraform will perform the following actions: # null_resource.resource_A has moved to null_resource.resource_X resource "null_resource" "resource_X" { id = "592263413744525319" }
Terraform will perform the following actions: # null_resource.resource_A has moved to null_resource.resource_X resource "null_resource" "resource_X" { id = "592263413744525319" }
Plan: 0 to add, 0 to change, 0 to destroy.
Do you want to perform these actions? Terraform will perform the actions described above. Only 'yes' will be accepted to approve.
Enter a value: yes
Apply complete! Resources: 0 added, 0 changed, 0 destroyed. $ terraform state list null_resource.resource_B null_resource.resource_C null_resource.resource_X