title: Terraform - Error loading modules - no such file or directory (after folder renaming)
body: <p>I'm facing a strange issue while using <a href="/questions/tagged/terraform" class="post-tag" title="show questions tagged &#39;terraform&#39;" rel="tag">terraform</a>.</p>
  
  <p>Consider the following file system:</p>
  
  <pre><code>├── Modules
  │   └── IAM
  │       ├── outputs.tf
  │       ├── resources.tf
  │       └── variables.tf
  ├── outputs.tf
  ├── providers.tf
  ├── resources.tf
  
  (Created automatically  by Terraform)
  ├── terraform.tfstate
  └── terraform.tfstate.backup
  </code></pre>
  
  <p>I calling the <code>IAM</code> module from the <code>root</code> module:</p>
  
  <pre><code>##resources.tf
  
  # Other Resource configuration...
  
  
  # Calling IAM module
  module "iam" {
    source = "Modules/IAM"
  }
  </code></pre>
  
  <p>This is simple and <strong>everything was working well until I renamed the module's <em>folder</em> name</strong>.</p>
  
  <p>The original name of the folder was <code>IAM_Module</code> and when I changed it to <code>IAM</code> things started to break.</p>
  
  <p>The output of <code>terraform init</code> (The name of the <strong>module</strong> is <code>iam</code> so don't get confused):</p>
  
  <pre><code>Initializing modules...
  - module.iam
  Error downloading modules: Error loading modules: module iam:
  open .terraform/modules/94...5b: no such file or directory
  </code></pre>
  
  <p>Checking inside <code>.terraform/modules</code> I can see that a symbolic link to the old name of the folder (<code>IAM_Module</code>) still exist for some reason:</p>
  
  <pre><code>├── 94...5b -&gt; /lab1/Modules/IAM
  ├── b7...3d -&gt; /lab1/Modules/IAM_Module &lt;--- Previous name of folder
  └── modules.json
  </code></pre>
  
  <p>Inside <code>terraform.tfstate</code> I can see that the module exist (after root):</p>
  
  <pre><code>"modules": [
      {
          "path": [
              "root"
          ],
          "outputs": {},
          "resources": {},
          "depends_on": []
      },
      {
          "path": [
              "root",
              "iam" &lt;----- Here
          ],
          "outputs": {},
          "resources": {
  </code></pre>
  
  <p>I tried to <code>terraform refresh</code> but I'm receiving the same <code>no such file or directory</code> error.</p>
  
  <p>Terraform version: v0.11.11.</p>
  
  <p>Any help will be appreciated.</p>
  
  <hr>
  
  <p>(*) In <a href="https://stackoverflow.com/questions/48057222/terraform-v0-11-1-error-downloading-modules-error-loading-modules-open-terr">this thread</a> it seems that they solved the same error (caused by different reason) by manual intervention which I would prefer to avoid.</p>