I use terrafrom to build aws resource and it work fined before,but today I suddenly got a error “error configuring Terraform AWS Provider: no valid credential sources for Terraform AWS Provider found.” when run the terraform plan commend, and the full error is ╷
│ Error: error configuring Terraform AWS Provider: no valid credential sources for Terraform AWS Provider found.
│
│ Please see Terraform Registry
│ for more information about providing credentials.
│
│ Error: 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: connectex: A socket operation was attem
pted to an unreachable network.
│
│
│ with provider[“Terraform Registry”],
│ on main.tf line 5, in provider “aws”:
│ 5: provider “aws” {
│
╵
my provider config is:
terraform {
required_version = “>=0.12”
}
provider “aws” {
profile = var.profile
shared_credentials_files = ["~/.aws/credentials"]
region = var.region
allowed_account_ids = [var.accountId]
}
looks like it can’t find the profile in shared_credentials_files,could someone please help me out?