ebro
ebro

Reputation: 67

Terraform backend configuration failing

So I am trying to execute terraform init with a customer backend configuration. But I keep getting below error message.

I tried googling it with no success. Any thoughts on the possible reason why the error below?

Here is what I run:

   terraform init -backend-config="key=dev/dev01/network" -backend-config="bucket=st-cf-dev" -backend-config="region=us-gov-west-1"

Error message:

Error configuring the backend "s3": error validating provider credentials: error calling sts:GetCallerIdentity: RequestError: send request failed
caused by: Post https://sts.us-gov-west-1.amazonaws.com/: net/http: invalid header field value

Notes: 1- the aws acccess key has full permission 2- I am using S3 as a backend for my terraform

Upvotes: 0

Views: 6461

Answers (2)

ebro
ebro

Reputation: 67

The issue was a white space at the end of the environment variable.

for this one: $AWS_ACCESS_KEY_ID

But check for $AWS_SECRET_ACCESS_KEY as well!!!

Upvotes: 1

pijemcolu
pijemcolu

Reputation: 2595

This is not necessarily a backend configuration issue but a credentials issue.

How do you have your credentials defined? Static credentials can be provided as:

provider "aws" {
  region     = "us-gov-west-1"
  access_key = "your-access-key"
  secret_key = "your-secret-key"
}

Upvotes: 0

Related Questions