tarmak
tarmak copied to clipboard
Recover from removed remote Terraform state
Is this a BUG REPORT or FEATURE REQUEST?: /kind feature (I think)
What happened: I created & destroyed a cluster yesterday. Then my remote state was destroyed by aws nuke overnight.
Today I tried to apply the cluster again and got the following error:
DEBU[0018] Error locking source state: Error acquiring the state lock: 2 errors occurred: app=tarmak module=terraform std=err
DEBU[0018] * ResourceNotFoundException: Requested resource not found app=tarmak module=terraform std=err
DEBU[0018] status code: 400, request id: NFL38JRIJN6LLH3MM7FLSEF1HVVV4KQNSO5AEMVJF66Q9ASUAAJG app=tarmak module=terraform std=err
DEBU[0018] * ResourceNotFoundException: Requested resource not found app=tarmak module=terraform std=err
DEBU[0018] status code: 400, request id: K4BS1CNOHO7VNL2AAC2MOVOATJVV4KQNSO5AEMVJF66Q9ASUAAJG app=tarmak module=terraform std=err
DEBU[0018] app=tarmak module=terraform std=err
DEBU[0018] app=tarmak module=terraform std=err
DEBU[0018] app=tarmak module=terraform std=err
DEBU[0018] Terraform acquires a state lock to protect the state from being written app=tarmak module=terraform std=err
DEBU[0018] by multiple users at the same time. Please resolve the issue above and try app=tarmak module=terraform std=err
DEBU[0018] again. For most commands, you can disable locking with the "-lock=false" app=tarmak module=terraform std=err
DEBU[0018] flag, but this is not recommended. app=tarmak module=terraform std=err
ERRO[0018] Tarmak exited with an error: failed to prepare terraform: failed to run terraform init: exit status 1
I then removed my cluster's local terraform config:
rm -r ~/.tarmak/envname-clustername/terraform
After doing this, I was able apply the cluster again.
What you expected to happen: I'd like Tarmak to be able to recover from this error without my intervention.