You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
10 lines
548 B
10 lines
548 B
#!/bin/sh
|
|
# This currently will only import aws_route53_records - and it will output the commands to be run
|
|
# Please only use this as a last resort
|
|
grep -A 100000 "Terraform will perform the following actions:" $1|grep -B 1000000 "Plan:"|sed 's/\e\[\d*(;\d+)*m//g'| \
|
|
awk \
|
|
'$1 == "+" && $2 ~ /aws_route53_record/ { active = 1; record = $2 };
|
|
$1 == "name:" { name = $2; };
|
|
$1 == "zone_id:" { id = $2; };
|
|
$1 == "type:" { type = $2; };
|
|
$0 == "" { if (active) print "terraform import " record " " id "_" name "_" type; active = 0; }'| sed 's/"//g' |