How to use terraform import with module Terraform v0.11.11
We have a quite big AWS setup created with Terraform. Different regions are applied separately, and that is why we have most of the things in modules which are imported like this:
module &quot;assets&quot; {
  source       = &quot;../modules/aws-assets&quot;
  environment  = &quot;${var.environment}&quot;
  upload_users = &quot;${var.upload_users}&quot;
}

We have one s3 bucket created manually, and I try to import it. Terraform import command does not find the configuration file and errors.
Error: resource address &quot;aws_s3_bucket.machine-learning&quot; does not exist in the configuration.

Before importing this resource, please create its configuration in the root module. For example:
resource &quot;aws_s3_bucket&quot; &quot;machine-learning&quot; {
  # (resource arguments)
}

terraform apply/plan do find the configuration and wants to create it which is not what we want?
Thanks for you help!
================================
Edit:
now moved configuration to root and ended up with different error...
The terraform import command uses the "Resource Address" syntax, which is a way to talk about objects in a configuration from outside of that configuration. (This is as opposed to references in the main Terraform language, which are always resolved in the context of a particular module.)

To refer to a resource that is declared in a child module, you can add a module path to the beginning of the address:

terraform import module.assets.aws_s3_bucket.machine-learning BUCKET-NAME