first of all: tfautomv is awesome! It is currently saving us a lot of work!
We are currently in the progress of refactoring an AWS VPC module which needs to be applied to a lot of VPCs afterward. We are executing tfautomv in two terragrunt hooks:
The reason for executing tfautomv twice is the fact that the moves cannot be identified correctly for vpc_route_table_associations since terraform does not know the subnet_id and route_table_id after the first plan.
When executing tfautomv a second time the moved blocks are not correctly appended to the moves.tf resulting in the following error:
│ Error: Missing newline after block definition
│
│ on moves.tf line 80, in moved:
│ 77: moved {
│ 78: from = module.this.aws_vpc_ipv4_cidr_block_association.this[1]
│ 79: to = aws_vpc_ipv4_cidr_block_association.this["nr_172.16.0.0/20"]
│ 80: }moved {
│
│ A block definition must end with a newline.
In tfautomv\pkg\terraform\move.go I added a \n to:
func (m Move) block() string {
return fmt.Sprintf("moved {\n from = %s\n to = %s\n}\n", m.FromAddress, m.ToAddress)
}
With that small change, our approach is successful and moved blocks are correctly written in the first run and appended correctly in the second run.
It would be awesome if you could implement a corresponding fix.
Hi!
first of all:
tfautomv
is awesome! It is currently saving us a lot of work!We are currently in the progress of refactoring an AWS VPC module which needs to be applied to a lot of VPCs afterward. We are executing
tfautomv
in twoterragrunt
hooks:The reason for executing
tfautomv
twice is the fact that the moves cannot be identified correctly forvpc_route_table_associations
sinceterraform
does not know thesubnet_id
androute_table_id
after the first plan.When executing
tfautomv
a second time themoved
blocks are not correctly appended to themoves.tf
resulting in the following error:In
tfautomv\pkg\terraform\move.go
I added a\n
to:With that small change, our approach is successful and
moved
blocks are correctly written in the first run and appended correctly in the second run.It would be awesome if you could implement a corresponding fix.
Thanks a lot!