How to import an external lambda layer into terraform?

I’m trying to use datadog lambda layer in my lambda function to send datadog metrics:

I can set this up manually from console. However, I’m not sure how to get it working in terraform. So far I have the following resource:

resource "aws_lambda_layer_version" "datadog_layer" {
  layer_name = "${local.datadog_layer_name}"

  compatible_runtimes = ["python2.7"]

And I tried to import it with:

terraform import ...<my_module>.aws_lambda_layer_version.datadog_layer "arn:aws:lambda:us-west-2:464622532012:layer:Datadog-Python27:9"

However, I’m getting the following error:

Error: Reference to undeclared resource

.terraform/modules/mymodule/modules/lambda_function/ line 24, in resource "aws_lambda_function" "lambda_function":
  24:   layers        = ["${aws_lambda_layer_version.datadog.arn}"]

A managed resource "aws_lambda_layer_version" "datadog" has not been declared

in mymodule.my_lambda.lambda_function.

The reason I used the resource instead of the data source is because in terraform doc for the resource it shows that we can import it:

Any suggestion on how I can make this work?

Never mind. stupid mistake. I misquoted the resource name.