##コード
resource "aws_ecr_repository" “XXXXimage" {
name = “XXXXmage"
}
terraform {
backend "s3" {
bucket = "ston-terraform-container"
key = “XXXXXterraform/ecr/terraform.tfstate"
region = "ap-northeast-1"
}
}
provider "aws" {
region = "ap-northeast-1"
}
##エラー
##Error inspecting states in the "s3" backend:
S3 bucket does not exist.
The referenced S3 bucket must have been previously created. If the S3 bucket
was created within the last minute, please wait for a minute or two and try
again.
Error: NoSuchBucket: The specified bucket does not exist
status code: 404, request id: xxxxxxxxxhost id: xxxxxxxxxxxxxx
##結論
失敗した際のXXXX.tfstateファイルが残っていると、差分が起きてしまうらしいので、ファイルを削除して、再度initコマンドで解決しました!
詳細はわかっていないので、わかり次第追記します!
##参考記事
StackOverFlow-Error inspecting states in the “s3” backend: NoSuchBucket: The specified bucket does not exist