For the following step I assume that you have Terraform already configured and the DigitalOcean provider retrieves the authentication token from the
DIGITALOCEAN_TOKEN environment variable.
If you have an old provider version you’ll need to upgrade the provider using
terraform init -upgrade as the capability was added to provider as part of pull request #71 which is included in v1.0.0.
First we need to lookup the key id for the DNS resource record that we want to import through the DigitalOcean REST API:
http https://api.digitalocean.com/v2/domains/2i.at/records “Authorization:Bearer $DIGITALOCEAN_TOKEN”
We then use this ID to import the record into Terraform:
terraform import digitalocean_record.ns 2i.at,25712647
Now you can execute
terraform plan again and take it from there.