elct9620 / terraform-provider-lambdalabs

The Lambdalabs provider for Terraform
Apache License 2.0
9 stars 0 forks source link

private key not removed on `terraform destroy` #3

Closed ephemer closed 1 year ago

ephemer commented 1 year ago

I get an error when trying to recreate a resource:

lambdalabs_ssh_key.primary: Creating...
╷
│ Error: Error creating SSH Key
│
│   with lambdalabs_ssh_key.primary,
│   on main.tf line 13, in resource "lambdalabs_ssh_key" "primary":
│   13: resource "lambdalabs_ssh_key" "primary" {
│
│ Could not create SSH Key, unexpected error: Bad Request

Because the ssh key provisioned in the previous terraform apply does not get removed when running terraform destroy.

Actually, it appears that there is an error while removing the provisioned key:

lambdalabs_instance.stable_diffusion: Destroying... [id=2cc5e6c437a741a2959de13f42f0a3c9]
lambdalabs_instance.stable_diffusion: Destruction complete after 1s
local_sensitive_file.ssh_private_key: Destroying... [id=eb107ac0a58ad01b0d67e5ff1b82dd6ee86f3931]
local_sensitive_file.ssh_private_key: Destruction complete after 0s
lambdalabs_ssh_key.primary: Destroying... [id=587c0035bd424ba9a45ece47e68f8653]
lambdalabs_ssh_key.primary: Destruction complete after 0s
╷
│ Warning: Error Delete Lambdalabs SSH Key
│
│ Unsupported Method
╵

Destroy complete! Resources: 3 destroyed.
elct9620 commented 1 year ago

The API didn't support deleting the SSH key when I implemented it. Therefore didn't delete it.

elct9620 commented 1 year ago

I have added destroy ssh key implementation to v0.2.0, you can try it after the build is finished.