i've had this issue in terraform with backend configuration. I am getting this error when running Terraform plan.
Error: error configuring Terraform AWS Provider: no valid credential sources for Terraform AWS Provider found. │ │ Please see https://registry.terraform.io/providers/hashicorp/aws │ for more information about providing credentials. │ │ Error: failed to refresh cached credentials, no EC2 IMDS role found, operation error ec2imds: GetMetadata, request send failed, Get "http://169.254.169.254/latest/meta-data/iam/security-credentials/": dial tcp 169.254.169.254:80: i/o timeout
with provider["registry.terraform.io/hashicorp/aws"].west,
│ on providers.tf line 5, in provider "aws": │ 5: provider "aws" { │ ╵
Here is the code, there are no google pages to help with this error. I will appreciate any help and I'm forever grateful thanks
terraform {
`enter code here`backend "remote" {
organization = "Gnome2"
workspaces {
name = "terraform-begin"
}
}
required_providers {
aws = {
source = "hashicorp/aws"
version = "4.8.0"
}
} }
provider "aws" {
region = "us-east-1"
}
provider "aws" {
alias = "west"
region = "us-west-1"
}
module "vpc" {
source = "terraform-aws-modules/vpc/aws"
providers = {
aws = aws.west
}
name = "my-vpc"
cidr = "10.0.0.0/16"
azs = ["us-east-1a", "us-east-1b", "us-east-1c"]
private_subnets = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"]
public_subnets = ["10.0.101.0/24", "10.0.102.0/24", "10.0.103.0/24"]
enable_nat_gateway = true
enable_vpn_gateway = true
tags = {
Terraform = "true"
Environment = "dev"
}
}
Can you use your AWS CLI to connect to your AWS account? like listing your AWS s3 buckets? based on the error I think you didn't configure your AWS by doing aws configure
on your CLI. which will require you to have an access key id and secret for the setup.