Question

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

Posted January 10, 2022 92 views
Configuration ManagementAnsibleTerraformInfrastructure

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 “dotoken=${DOPAT}” -var “pvtkey=/home/ubuntu/terraform-ansible/awsrsa” -var “pubkey=~/.ssh/awsrsa.pub”

I get an error


│ Error: no ssh key found with name terraform

│ with data.digitaloceansshkey.terraform,
│ on provider.tf line 18, in data “digitaloceansshkey” “terraform”:
│ 18: data “digitaloceansshkey” “terraform” {

Not sure what I did wrong

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.

×
Submit an Answer
1 answer

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

by Mitchell Anicas
by Brian Hogan
Terraform is a tool for building and managing infrastructure in an organized way. In this tutorial, you'll install and use Terraform to create an infrastructure on DigitalOcean that consists of two Nginx servers that are load balanced by a DigitalOcean Load Balancer.