aws provider with s3 backend setup

1,282 views
Skip to first unread message

Ernesto Cejas

unread,
Jul 31, 2017, 11:58:18 AM7/31/17
to Terraform
Hi,

I cant get "terraform init" to succeed. I don't understand how how troubleshoot this. 

i have in example.tf :

terraform { 
     backend "s3" { 
       bucket = "<bucketname>" 
       region = "us-east-1" 
       encrypt = true 
       kms_key_id = "<kms_key>" 
       key = "<filename>"  
       dynamodb_table = "<table_name>" 
     } 
}

provider "aws" { 
  region = "us-east-1" 
  access_key = "<key>" 
  secret_key = "<key>" 
}

when I do $./terraform init  i get:

Error configuring the backend "s3": No valid credential sources found for AWS Provider...

When I use local state files, it inits fine. What are possible points of failures for this?

thanks!


Ernesto Cejas

unread,
Jul 31, 2017, 2:11:49 PM7/31/17
to Terraform
So, it works when I populate the environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY). Also works if I create the ~/.aws/credentials file with default profile. 

So, my question becomes now: Why terraform doesnt detect inline credentials for remote backend? In which cases this could happen?

thanks! 

Trung Nguyen Kien

unread,
Jul 31, 2017, 2:49:40 PM7/31/17
to Terraform
Per https://www.terraform.io/docs/backends/types/s3.html, you need to configure access_key and secret_key as attributes in `backend "s3"` block.
I don't think `provider` block reflects here.
Reply all
Reply to author
Forward
0 new messages