'Using the very configuration Terraform is trying to remove on import as the configuration of the resource - will it work?

I am importing an existing AWS lambda function into Terraform, (using terraform import), and the downside of terraform import is that you have to write the configuration yourself (and have it match one to one with the existing resource). So I was wondering, before I write the configuration I can run terraform plan and it will show me the imported resource it will remove, something like

- resource "lambda-function" "bar"{
  -arn "some_arn" -> null
  # ....
}

So why can't I just take this configuration Terraform is trying to remove and use it as the configuration of the existing resource?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source