Moving module to root with Terraform state mv

363 views
Skip to first unread message

Andrew Hodgson

unread,
Jul 11, 2017, 4:30:46 PM7/11/17
to terrafo...@googlegroups.com

Hi guys,

 

Any quick way to move a module to the root using Terraform state mv?  I had to move each resource individually.  I was hoping to do something like:

 

Terraform state mv module.test module.root

 

However when I did that it moved everything to a module called root.

 

I ended up having to do:

 

Terraform state mv module.test.aws_autoscaling_group.bar aws_autoscaling_group.bar

 

Also whilst on the same topic I had some really strange errors with Terraform 0.9.11 when moving data sources (aws_iam_policy_document resources) from the root module to another module.  I ended up just leaving those resources in place in the root module, then running Terraform apply which moved the resources properly.  Sorry not to give more details on this issue, I need to sit down longer with it, but just asking here if anyone has seen that so I don’t spend ages working through a solution to get an example for an issue report.

 

Thanks.

Andrew.

Reply all
Reply to author
Forward
0 new messages