Common Terraform errors and possible solution

Error: error configuring S3 Backend: no valid credential sources for S3 Backend found.

That possibly means you are not correctly logged into your AWS account

2. When you do a terraform plan terraform throws the below error —

Acquiring state lock. This may take a few moments...Error: Error acquiring the state lock│ Error message: 2 errors occurred:│  * ResourceNotFoundException: Requested resource not found│  * ResourceNotFoundException: Requested resource not found│ Terraform acquires a state lock to protect the state from being written│ by multiple users at the same time. Please resolve the issue above and try│ again. For most commands, you can disable locking with the "-lock=false"│ flag, but this is not recommended.

How to fix this error?

You can enable TF_LOG to DEBUG to get more messages.

export TF_LOG=DEBUG

One of the messages i found is dynamo db table insertion is an issue.

2021-08-04T12:54:22.712+0200 [DEBUG] [aws-sdk-go] DEBUG: Response dynamodb/PutItem Details:---[ RESPONSE ]--------------------------------------HTTP/1.1 400 Bad RequestConnection: closeContent-Length: 112Content-Type: application/x-amz-json-1.0Date: Wed, 04 Aug 2021 10:54:22 GMTServer: Server

so i created the dynamo db table with the correct name and with partition_key: LockID and the error was solved.

3. Now while working with modules this may pop up —

Error: Variables not allowed│   on main.tf line 17, in module "eks_environment":│   17:   source                    = var.source

And this took me quite some time to find out,

you need to keep 2 copies of variables.tf and blahblah.tfvars — one under the root directory which has main.tf and where the referencing to path of module takes place, and the second at module directory. Which is really annoying.

--

--

--

Transforming Ideas into code

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Reading entire website content is really easy using R

Golang + React Application

Updates and Videos from re:Invent 2017

HomeAway image processing pipeline

A First Look: instantOS beta 5.1

Managing containers with an IoT Platform

How to start the game — Piratera Guide for beginners

Contributing to your preferred open source project, starring Flutter — part 1

How To Build A Digital Bank Part 3

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Dipesh Majumdar

Dipesh Majumdar

Transforming Ideas into code

More from Medium

A Quick Guide to GraphQL

Install Zabbix 5.0 LTS for your production environments

Kubernetes Architecture in a Nutshell

Build Golang and Kubernetes using source code and deploy Kubernetes on ppc64le by using kubeadm