Error: error configuring Terraform AWS Provider:
error validating provider credentials: error calling sts:GetCallerIdentity: operation error STS: GetCallerIdentity, https response error StatusCode: 403, RequestID: 95e52463-8cd7-038-b924-3a5d4ad6ef03, api error InvalidClientTokenId: The security token included in the request is invalid. with provider["registry.terraform.io/hashicorp/aws"], on provider.tf line 1, in provider "aws": 1: provider "aws" {
I have only two files.
- instance.tf
resource "aws_instance" "web" {
ami = "ami-068257025f72f470d"
instance_type = "t2.micro"
tags = {
Name = "instance_using_terraform"
}
}
- provider.tf
provider "aws" {
region = "ap-east-1"
access_key = "xxxx"
secret_key = "xxxx/xxx xxx"
}
CodePudding user response:
Check .aws folder(CONFIG FILE). Try this
aws sts get-caller-identity
{
"UserId": "AIDAYMYFUCQM7K2RD9DDD",
"Account": "111147549871",
"Arn": "arn:aws:iam::111147549871:user/myself"
}
Also show us your main.tf file and where and how you define access.
CodePudding user response:
Made mistake in the region where I declared entered the wrong namecode of region and access key - secret key ' ' and '/' generating the error due to some symbols, you just need to try the new key till the access key contains only alphabetical string. (Symbols are lmao).