DevOps/👾IaC

[Terraform Error] Failed to get existing workspaces: S3 bucket does not exist

키깡 2024. 1. 10.
728x90

문제 상황

  • 개요: terraform으로 이것저것 만들어 본 후 terraform destroy로 지우려고 하는데 계속 백엔드 버킷 오류가 나서 단순하게 정책 오류인 줄 알았다.
  • 오류 메시지:  Failed to get existing workspaces: Unable to list objects in S3 bucket "버킷이름": operation error S3: ListObjectsV2, https response error StatusCode: 403, RequestID: , HostID: =, api error AccessDenied: Access Denied

 

원인

 aws configure을 다른 프로필로 사용하고 있었는데 (aws configure --profile terraform 과 같이) 사용 중인 기본 aws 프로필이 Terraform에 필요한 권한을 갖고 있지 않은 것. 이를 해결하기 위해 aws configure --profile 명령어로 설정한 프로필을 환경 변수에 지정하는 것이 필요합니다.profile 변수를 환경변수로 잡아줘야함

 

해결

export AWS_PROFILE=프로필명
terraform destroy # terraform 명령어

 

 

Terraform init Error: Failed to get existing workspaces: S3 bucket does not exist

Hi i have an issue with terraform not being able to see the s3 bucket when i specify it as a backend aws --profile terraform s3api create-bucket --bucket "some_name_here" --region "e...

stackoverflow.com

 

댓글