Course 1 Module 4 lab (Programming Assignment: Assignment 3) debug tip

Hello, wanted to provide a solution to an error I ran into. Hopefully it can help someone else out.

When I was doing this lab I ran into the following error message when trying to run ‘terraform init’ for the first time:

Initializing the backend...
Initializing modules...
Initializing provider plugins...
- Finding latest version of hashicorp/aws...
╷
│ Error: Incompatible provider version
│ 
│ Provider registry.terraform.io/hashicorp/aws v6.1.0 does not have a package available for your current platform, linux_amd64.
│ 
│ Provider releases are separate from Terraform CLI releases, so not all providers are available for all platforms. Other versions of this provider may have different platforms supported.

To get around this issue, I did the following two steps:

  1. in the main terraform file, add the following code to the very top of the file:
terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 5.38.0"
    }
  }
}
  1. Instead of running ‘terraform init’ run ‘terraform init -upgrade’ instead.

Shoutout to ChatGPT for the assist lol.

2 Likes