Question

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

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


Submit an answer

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!

Sign In or Sign Up to Answer

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