###なにこれ
このコマンドはterraformで起動したAWSリソースを誰かが手動で消してしまった場合に使います。
あなたのterraform.tfstateファイルにはリソースは存在していることになっており、かつ、実際にはリソースがなくなっている場合を想定してください。
あなたはterraform.tfstateに記載されているjsonを直接編集しなくとも、
terraform state rm
を用いて対象のリソースを設定から取り除くことができます。
まとめて削除したい場合にはシェルで一気にエラーが生じたリソースのみ取り除けます。
Last active
March 4, 2017 09:23
-
-
Save takenoko-str/a518370d20163589ef40c9503ee0d7a3 to your computer and use it in GitHub Desktop.
terraform remove states in the terraform.tfstate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(terraform plan 1> /dev/null) 2>&1 | grep \* | awk '{print $2}' | sed "s|:||g" | xargs terraform state rm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment