New to Terraform error with backend.tf and s3 bucket

Hi

I am new to terraform and have tried to config a s3 bucket as a backend repository by setting the following in backend.tf:

Terraform {
Backend “s3” {
bucket = “bucketname/”
region = “eu-west-1”
key = “demo4”
}
}

When I run terraform init I get the following error message:

Initializing the backend…

Error: Unknown root level key: Terraform

I have checked the bucket policy and from what I can see the permissions are fine, I have connected to the bucket using AWS CLI and can upload files , retrieve files lists etc so don’t think its permissions related.

Can you help please?

Hey there,

It may be a simple matter of case where Terraform is looking for the terraform key in lieu of Terraform.

Edit: You might want to try using terraform validate as it can often provide some hints as to where things might need a little tweaking.

PK

Hi PK

Thank you very much it was as simple as that , appreciate your help in resolving this.

thanks

1 Like