Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
terraform import command fails when there are several nested levels on the resource address #8713
The terraform import command fails with an error message when you try to import a resource the was created from a module that has several nested levels.
AWS. Any resource created from a module with several nested subdirectories.
The terraform import command works fine and finally import the resource no matters how many levels it has.
The terraform import command fails when the resource address has several nested levels.
Steps to Reproduce
Our main project structure is like this:
The call to the modules occurs in this order:
If We are inside dev directory and We execute a terraform import command We get this error message:
hostname:dev julian$ terraform import module.network.vpc.aws_vpc.vpc vpc-vpcxxxxid
And the import fails.
We import the resource address with this command:
After this the resource is imported and We manually change the resource in the tfstate editing the file. If We move the resource with the command "terraform state mv source.address destination.address" We get an error too.
The same is valid for renaming/moving states! I'm currently refactoring one component out into a module, which itself is using a module as well.
This didn't work:
Seriously, the inconsistency is really strange.…
On Jun 20, 2017 20:00, "Matt Dodge" ***@***.***> wrote: I would actually even be ok with this behavior (having to write module twice). I would only request that the output of terraform plan would behave the same way. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#8713 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ABcV0W-VhEYfYaKACuIZt4w6Xz_RG5Qzks5sGGsogaJpZM4J27gL> .