How to fix Error: error configuring Terraform AWS Provider: error validating provider credentials: error calling sts:GetCallerIdentity: operation error STS: GetCallerIdentity, https response error StatusCode: 403, RequestID: 86f71cc7-9d56-4f2e-abf6-bb36c8011db6, api error InvalidClientTokenId: The security token included in the request is invalid ?
Error: error configuring Terraform AWS Provider: error validating provider credentials: error calling sts:GetCallerIdentity: operation error STS: GetCallerIdentity, https response error StatusCode: 403, RequestID: 86f71cc7-9d56-4f2e-abf6-bb36c8011db6, api error InvalidClientTokenId: The security token included in the request is invalid.
│
│ with provider["registry.terraform.io/hashicorp/aws"],
│ on main.tf line 11, in provider "aws":
│ 11: provider "aws" {
Error configuring Terraform AWS Provider
Table of Contents
I faced this error when I updated my Terraform code at this block:
provider "aws" {
region = var.region
shared_config_files = ["/home/dungpham/.aws/config"]
shared_credentials_files = ["/home/dungpham/.aws/credentials"]
profile = "default"
}
I just changed the profile and got the error. Why this happened?
This error caused by Terraform couldn’t get the permission to access the provider AWS.
You can see block provider above, we use the configurations from awscli and inside this one, we’re using IAM key and secret.
How to fix this error?
- The first thing, you should check the configurations inside .aws folder. May there are some miss characters or waste characters.
- The second thing, you login to your AWS account and check if your IAM key still in active.
- If your IAM key still active then compare it with your current configurations inside .aws folder.
- And if still not working, you can create a new IAM User with a new IAM key and secret then update the new one to your configurations inside .aws folder.
Conclusion
This error is not a serious problem but with someone newbie, it’s may make you worries a bit.
So I wrote my experience to make you feel better when see it. Cheers !
Thanks