Reputation: 1826
I am running terraform init
on my terraform modules folder and I am getting below.
Error inspecting states in the "s3" backend:
NoSuchBucket: The specified bucket does not exist
status code: 404, request id: 6667B0A661F9C62F, host id: 3mC8DNrS/gGHtp7mhVMRtpIUeMaNXs2cEozEY+akZf1ixFD6x2qQx7c3mX02M1BIbyfYowYt35s=
Upvotes: 21
Views: 25325
Reputation: 1
In my case just remove all directory from terraform and again hit terraform init command via git, now working for me.
Upvotes: 0
Reputation: 60114
In my case even when I removed that .terraform
as mentioned does not work, I have to add the profile in s3 backend module even profile exist in provider.
adding configuration might help others.
provider "aws" {
region = var.region
profile = "myprofile"
}
terraform {
backend "s3" {
encrypt = true
bucket = "appname-terraform-state"
region = "ap-southeast-1"
key = "terraform.tfstate"
profile = "myprofile"
}
}
Upvotes: 1
Reputation: 993
I was getting the similar issue as below
Error inspecting states in the "s3" backend:
AccessDenied: Access Denied
status code: 403, request id: XXXXXX, host id: XXXXX
And after removing the .terraform file it worked (In my case I was using Jenkins, so I have to remove it from Jenkins server's project directory and it worked for me). Thanks !
Upvotes: 5
Reputation: 620
I was having the same issue.
Using aws command aws s3 ls
and aws s3api list-objects --bucket bucket-name
I could list the content but was still having the same issue.
Error inspecting states in the "s3" backend: NoSuchBucket: The specified bucket does not exist status code: 404, request id: xxxxx, host id: xxxxxx
Erased the ./terraform
directory and it fixed my issue.
Upvotes: 43