Ao tentar aplicar do comando Terraform init ocorre este erro:
│ Error: Failed to query available provider packages
│
│ Could not retrieve the list of available versions for provider
│ terraform-providers/terraform-providers/aws: could not connect to
│ terraform-providers: Failed to request discovery document: Get
│ "https://terraform-providers/.well-known/terraform.json": dial tcp: lookup
│ terraform-providers on 127.0.0.53:53: server misbehaving
│ Error: Failed to query available provider packages
│
│ Could not retrieve the list of available versions for provider
│ hashicorp/aws-instance: provider registry registry.terraform.io does not have
│ a provider named registry.terraform.io/hashicorp/aws-instance
│
│ 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/aws-instance, run the following
│ command:
│ terraform providers
Minha linha de código :
terraform {
required_providers {
aws = {
source = "terraform-providers/terraform-providers/aws"
version = "~> 3.0"
}
}
}
provider "aws" {
region = "us-east-2"
}
resource "aws-instance" "dev"{
count = 2
ami = "ami-0bbe28eb2173f6167"
instance_type = "t2.micro"
key_name = "terraform-aws"
tags = {
Name = "dev${count.index}"
}
}