Report this

What is the reason for this report?

Follow the example but get error when I run example for Terraform with Ansible

Posted on January 10, 2022

as i follow the example at https://www.digitalocean.com/community/tutorials/how-to-use-ansible-with-terraform-for-configuration-management

When I ran it terraform apply -var “do_token=${DO_PAT}” -var “pvt_key=/home/ubuntu/terraform-ansible/aws_rsa” -var “pub_key=~/.ssh/aws_rsa.pub”

I get an error

╷ │ Error: no ssh key found with name terraform │ │ with data.digitalocean_ssh_key.terraform, │ on provider.tf line 18, in data “digitalocean_ssh_key” “terraform”: │ 18: data “digitalocean_ssh_key” “terraform” { │ ╵

Not sure what I did wrong



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi there,

It looks like the SSH key is missing. You need to follow the steps from the prerequisites first and mainly this tutorial here which describes the steps that you need to take to configure your SSH keys:

https://www.digitalocean.com/community/tutorials/how-to-use-terraform-with-digitalocean

Hope that this helps! Best, Bobby

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.