Configuring Terraform provider AWS

36 views Asked by At

sc1

This is what I am getting when trying to Terraform plan for the first time.

line 11 SC

Error: error configuring Terraform AWS Provider: error validating provider credentials: error calling sts:GetCallerIdentity: operation error STS: GetCallerIdentity, https response error StatusCode: 403, RequestID: 96f0839a-abf6-415c-b886-66d41933cbc8, api error InvalidClientTokenId: The security token included in the request is invalid.

  • Created new IAM user on AWS
  • Used same credentials on the VScode extension on it worked for the extension.

I expect this to work smoothly, as I ran out of errors to check for.

1

There are 1 answers

0
Ezequiel Gonzalez Rial On BEST ANSWER

The problem is that you are setting the attribute with a string intead to read the variable value.

Instead of

provider "aws" {
  region     = "us-west-1"
  access_key = "var.access_key"
  secret_key = "var.secret_key"
}

you should remove the quotes so it can read the variables values.

provider "aws" {
  region     = "us-west-1"
  access_key = var.access_key
  secret_key = var.secret_key
}