[Terraform] Error acquiring the state lock, message: resource not found.

HYEOB KIM·2022년 4월 12일
0

Trouble Shooting

목록 보기
2/7

에러 메세지

terraform apply 시 아래의 에러가 발생했습니다.

$ terraform apply

Error: Error acquiring the state lock

Error message: resource not found

Terraform acquires a state lock to protect the state from being written by multiple users at the same time. Please resolve the issue above and try again. For most commands, you can disable locking with the "-lock=false" flag, but this is not recommended.

테라폼 클라우드의 locking풀려져 있는 상태였습니다.

해결 방법

본 에러는 AWS CLI 상에서 자격 증명 변경해 AWS 사용자를 변경한 상태에서 Terraform Cloud사용자 API Token을 갱신하지 않아서 발생한 문제였습니다.

우측 상단의 계정 탭에서 User settings로 접근합니다.

토큰을 생성합니다.

토큰을 복사하여 ~/.terraformrc 파일에 붙여넣습니다.

$ vim ~/.terraformrc

이렇게 설정한 후, terraform apply를 수행하면 정상적으로 수행이 됩니다.

profile
Devops Engineer

0개의 댓글