Skip to main content
Solved

Error import KeyPair: InvalidKeyPair.Duplicate: The keypair already exists

  • September 6, 2024
  • 10 replies
  • 186 views

Forum|alt.badge.img

I am taking the Iac lab.   When i start the SST first time, i was able to launch the controller successfully.  After three day,  when i start from scratch, after gave the controller license, i am getting below error.  I tested three times, same error

in the community also , i dont see this error, so posting. pls assist to complete my iac certfication

=============================

module.aviatrix_controller_aws.module.aviatrix_controller_build.aws_instance.aviatrix_controller: Still creating... [10s elapsed] module.aviatrix_controller_aws.module.aviatrix_controller_build.aws_instance.aviatrix_controller: Creation complete after 12s [id=i-082846b0f48c10f3e] module.aviatrix_controller_aws.module.aviatrix_controller_build.aws_eip_association.eip_assoc: Creating... module.aviatrix_controller_aws.module.aviatrix_controller_build.aws_eip_association.eip_assoc: Creation complete after 2s [id=eipassoc-079ed04b3bf539b67] --> Controller launch failed, aborting.
/root/sandbox_starter_web.sh: line 813: [: too many arguments ╷ │
Error import KeyPair: InvalidKeyPair.Duplicate: The keypair already exists │ status code: 400, request id: c002c553-a270-4217-819b-ecb8b4493f6d │ │ with module.aviatrix_controller_aws.module.aviatrix_controller_build.aws_key_pair.controller_key_pair[0], │ on .terraform/modules/aviatrix_controller_aws/modules/aviatrix-controller-build/main.tf line 61, in resource "aws_key_pair" "controller_key_pair": │ 61: resource "aws_key_pair" "controller_key_pair" { │ ╵ --> Controller launch failed, aborting.

===============

 

Best answer by MohammedBanabila

try to delete all existing or previous resources along with key pair and then try to deploy resources again with new key pair with different name

10 replies

MohammedBanabila
Forum|alt.badge.img+5
  • Commander
  • 55 replies
  • Answer
  • September 6, 2024

try to delete all existing or previous resources along with key pair and then try to deploy resources again with new key pair with different name


Forum|alt.badge.img
  • Author
  • Cadet
  • 5 replies
  • September 6, 2024

let me test now. 


Forum|alt.badge.img
  • Author
  • Cadet
  • 5 replies
  • September 6, 2024

Thanks MohammedBanabila.   I am able to install the controller now, let me continue the iac lab.  


MohammedBanabila
Forum|alt.badge.img+5

most welcome @Ismauto 


Forum|alt.badge.img
  • Author
  • Cadet
  • 5 replies
  • September 7, 2024

In First lab, while execute the Terraform code, I see this error.   Any suggestion / direction.   I will continue this tomorrow again.   

 


MohammedBanabila
Forum|alt.badge.img+5

in azure account, did you create access IAM) with minimum permissions.

https://docs.aviatrix.com/documentation/latest/accounts-and-users/account-azure.html?expand=true 

 


MohammedBanabila
Forum|alt.badge.img+5

check if azure account has proper access control (IAM) permission and be sure that you added right permissions of particular azure account but not to other permissions that will cause mismatched permissions


Forum|alt.badge.img
  • Author
  • Cadet
  • 5 replies
  • September 10, 2024

I will test and update. 


Forum|alt.badge.img
  • Author
  • Cadet
  • 5 replies
  • September 12, 2024

MohammedBanabila
Forum|alt.badge.img+5

most welcome @Ismauto