I have an existing resource which i'd like to import into my config, to keep with style I have written this into a module, as below.
When I try to import it (using terraform import resource.module id) I get an error, as below
>Before importing this resource, please create its configuration in the root module.
If I add this to my root, it errors on a dupe resource.
How do I go about importing a resource which is not in my root module?
Current structure: #modules.tf
module my_module {
source ./modules
...
}
#./modules/main.tf
resource 'my_resource' 'my_resource_name' {
...
}
#./modules/output.tf
output {
value = ...
}