Member-only story

Troubleshooting and Fix the Terraform Inconsistent Dependency Lock File Error

A Step-by-Step Guide to Fixing the “Inconsistent Dependency Lock File” Error

Luca Berton
6 min readFeb 8, 2024

Introduction

When working with Terraform, especially in complex environments with multiple dependencies, encountering errors can be a common part of the development process. One such error revolves around the dependency lock file, which can lead to confusion and delay in your infrastructure management tasks. This article aims to shed light on the “Inconsistent Dependency Lock File” error, specifically when it occurs during the import of AWS instances or any other resources, and provides a step-by-step guide to resolve it effectively.

Understanding the Error

The error message Inconsistent dependency lock file indicates a mismatch between the dependencies recorded in Terraform's dependency lock file (terraform.lock.hcl) and the current configuration you are trying to apply or manipulate. In this context, the error occurred while attempting to import an AWS instance with the command:

terraform import aws_instance.example i-1234567890abcdef0

The key part of the error message is:


│ Error: Inconsistent dependency lock…

--

--

Luca Berton
Luca Berton

Written by Luca Berton

I help creative Automation DevOps, Cloud Engineer, System Administrator, and IT Professional to succeed with Ansible Technology to automate more things everyday

No responses yet