terraform/rename.awk: simpler version of move.awk

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2022-07-11 15:23:06 +02:00
parent b388b3510f
commit 9932ca7cea
No known key found for this signature in database
GPG Key ID: 09AA5403E54D9931
1 changed files with 14 additions and 0 deletions

14
terraform/rename.awk Normal file
View File

@ -0,0 +1,14 @@
# Script for renaming Terraform resources when changing names.
# WARNING: Use '-no-color' flag when running 'terraform plan'.
/will be/{
if ($5 == "updated") {
next
}
if ($5 == "created") {
new = $2
}
if ($5 == "destroyed") {
old = $2
printf "terraform state mv '%s' '%s'\n", old, new
}
}