title: What is the purpose of an import in Terraform?
body: <p>This question is <strong>not</strong> <em>how</em> to import and it's not <em>what's the purpose of tfstate</em>. It's what's the purpose of importing a pre-existing resource, esp. compared to just referencing the ID of the existing resource?</p>
  <p>Terraform has <a href="https://www.terraform.io/docs/import/index.html" rel="nofollow noreferrer">the feature of <code>terraform import</code></a>. HashiCorp describes the purpose of this as:</p>
  <blockquote>
  <p>Terraform is able to import existing infrastructure. This allows you take resources you've created by some other means and <em><strong>bring it under Terraform management</strong></em>.</p>
  </blockquote>
  <blockquote>
  <p>This is a great way to slowly transition infrastructure to Terraform, or to be able to be confident that you can use Terraform in the future if it potentially doesn't support every feature you need today.</p>
  </blockquote>
  <p>I read <a href="https://www.terraform.io/docs/state/purpose.html" rel="nofollow noreferrer">the article about the purpose of Terraform state</a>. It does make sense to me to track Terraform state with <code>.tfstate</code> files when those files are mappings back to the configurations in <code>.tf</code> files.</p>
  <p>But it's still unclear to me what the purpose of a standalone <code>.tfstate</code> file is when it only maps to an empty resource block. If there is a resource not in terraform yet, I would typically do one of two things:</p>
  <ol>
  <li>put the resource in terraform, tear down the resource manually and re-deploy the resource with terraform, or...</li>
  <li>keep the resource un-templated, reference its resource ID as a parameter and get its metadata via a data element for terraform-managed resources that rely on it.</li>
  <li>Is <code>terraform import</code> an alternative to those two approaches? And if so, why would you use that approach?</li>
  </ol>
  <p>The only way to make changes to an imported resource (that only has an empty resource block in the <code>.tf</code> file and detailed state in <code>.tfstate) is to make manual changes and then re-import into </code>.tfstate`, right? And if so, then what's the point of tracking the state of that resource in terraform?</p>
  <p>I'm sure there's a good reasons. Just want to understand this deeper! Thanks!</p>