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
를 수행하면 정상적으로 수행이 됩니다.