amazon-web-servicesvisual-studio-codeterraformidentity-management

Configuring Terraform provider AWS


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.

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


Solution

  • 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
    }