title: How can I import an existing resource already into terraform
body: <p>I am using <code>Terraform v0.12.6</code> to manage AWS infrastracture. I got this error when I deploy my configuration to AWS. I know that I need to import the existing resources but I don't know the parameter ID I should use.</p>
  
  <pre><code>Error: Error creating Security Group: InvalidGroup.Duplicate: The security group 'SecuritySearchElasticSearchencr' already exists for VPC 'vpc-0cce833ea304b0215'
      status code: 400, request id: c3bef103-023a-4d6f-888b-bcb8d024eff8
  
    on deploy/infra/modules/elasticsearch/security-groups.tf line 1, in resource "aws_security_group" "es":
     1: resource "aws_security_group" "es" {
  </code></pre>
  
  <p>when I run <code>terraform import aws_security_group.es vpc-0cce833ea304b0215</code> I got this error:</p>
  
  <pre><code>Error: resource address "aws_security_group.es" does not exist in the configuration.
  
  Before importing this resource, please create its configuration in the root module. For example:
  
  resource "aws_security_group" "es" {
    # (resource arguments)
  }
  </code></pre>
  
  <p>I also tried to import the security group ID but still same error:</p>
  
  <pre><code>#terraform import aws_security_group.es sg-0227291ba8162542d
  
  Error: resource address "aws_security_group.es" does not exist in the configuration.
  
  Before importing this resource, please create its configuration in the root module. For example:
  
  resource "aws_security_group" "es" {
    # (resource arguments)
  }
  </code></pre>
  
  <p>when I run <code>terraform plan</code>, I got:</p>
  
  <pre><code> + resource "aws_security_group" "es" {
        + arn                    = (known after apply)
        + description            = "Allow HTTPS inbound traffic"
        + egress                 = [
            + {
                + cidr_blocks      = [
                    + "0.0.0.0/0",
                  ]
                + description      = ""
                + from_port        = 0
                + ipv6_cidr_blocks = []
                + prefix_list_ids  = []
                + protocol         = "-1"
                + security_groups  = []
                + self             = false
                + to_port          = 0
              },
          ]
        + id                     = (known after apply)
        + ingress                = [
            + {
                + cidr_blocks      = []
                + description      = ""
                + from_port        = 443
                + ipv6_cidr_blocks = []
                + prefix_list_ids  = []
                + protocol         = "tcp"
                + security_groups  = [
                    + "sg-08e48ea67d2f8ebd6",
                    + "sg-0bdc3d7ce660183d8",
                  ]
                + self             = false
                + to_port          = 443
              },
          ]
        + name                   = "SecuritySearchElasticSearchencr"
        + owner_id               = (known after apply)
        + revoke_rules_on_delete = false
        + tags                   = {
            + "Application"            = "Security Search"
            + "Client"                 = "IRESS"
            + "DataClassification"     = "NoData"
            + "Name"                   = "Security Search ElasticSearch"
            + "Owner"                  = "platform"
            + "Product"                = "SharedServices"
            + "Schedule"               = "False"
            + "Service"                = "Elastic Search Cluster"
            + "TaggingStandardVersion" = "3"
          }
        + vpc_id                 = "vpc-0cce833ea304b0215"
      }
  </code></pre>
  
  <p>I wonder what command should I use in order to import the existing resource?</p>