Terraform - Error - aws_key_pair - ntpdate

I was getting following error when running my terraform apply command: I was able to fix it by using listed solution.

 

Error: Error applying plan:

1 error(s) occurred:

* aws_key_pair.mykey: 1 error(s) occurred:

* aws_key_pair.mykey: Error import KeyPair: AuthFailure: AWS was not able to validate the provided access credentials

status code: 401, request id: 7a414558-12fe-4f00-8973-0e82014c187c

Terraform does not automatically rollback in the face of errors.

Instead, your Terraform state file has been partially updated with

any resources that successfully completed. Please address the error

above and apply again to incrementally change your infrastructure.

 

Solution: 

  1. Make sure they key is not already created manually or by some other process.  Check the AWS console login and delete if necessary. 
  2. Check and confirm that AWS_ACCESS_KEY and AWS_SECRET_KEY are correct. not whitespace and not typo. 
  3. If you are running terraform from vagrant, then run following command on your vagrant box. 

timedatectl status

systemctl status systemd-timesyncd

sudo ntpdate ntp.ubuntu.com 

 

 More info: https://help.ubuntu.com/lts/serverguide/NTP.html.en

 

 

Add comment


Security code
Refresh