I’m trying to create a few private S3 buckets but I keep getting this error
│ Error: Inconsistent dependency lock file
│
│ The following dependency selections recorded in the lock file are inconsistent with the current configuration:
│ - provider registry.terraform.io/hashicorp/s3: required by this configuration but no version is selected
│
│ To update the locked dependency selections to match a changed configuration, run:
│ terraform init -upgrade
When running terraform init -upgrade I get
Initializing the backend...
Initializing provider plugins...
- Finding latest version of hashicorp/s3...
- Finding hashicorp/aws versions matching "~> 5.0"...
- Using previously-installed hashicorp/aws v5.61.0
╷
│ Error: Failed to query available provider packages
│
│ Could not retrieve the list of available versions for provider hashicorp/s3: provider registry registry.terraform.io does not have a provider named
│ registry.terraform.io/hashicorp/s3
│
│ All modules should specify their required_providers so that external consumers will get the correct providers when using a module. To see which modules are currently depending
│ on hashicorp/s3, run the following command:
│ terraform providers
I only get this error if I add
resource "s3_bucket_public_access_block" "block_public" {
bucket = aws_s3_bucket.block_public.id
block_public_acls = true
block_public_policy = true
ignore_public_acls = true
restrict_public_buckets = true
}
My current providers.tf:
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
}
}
}
provider "aws" {
region = "us-east-1"
}
provider "aws" {
alias = "us_east_1_VA"
region = "us-east-1"
}
I’m not sure what I’m doing wrong. Any help would be appreciated.
New contributor
zio is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.