Hashicorp/aws / Error: Invalid version constraint (A string value is required for aws.)

Given the following super basic config :

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 3.48.0"

provider "aws" {
  region  = "eu-west-3"

resource "aws_instance" "app_server" {
  ami           = "ami-08d70e59c07c61a3a"
  instance_type = "t2.micro"

I’m getting the following error :

Error: Invalid version constraint

  on backend.tf line 3, in terraform:
   3:     aws = {
   4:       source  = "hashicorp/aws"
   5:       version = "~> 3.0"
   6:     }

A string value is required for aws.

terraform -v outputs the following :

Terraform v1.0.2

on darwin_amd64

+ provider registry.terraform.io/hashicorp/aws v3.48.0

It migh be obvious, but i’m as i’m following the most basic tutorials on terraform for this given topic, I’m clueless about how to go further

Thanks a lot if anyone could help


Hi @benbonnet,

The configuration snippet shown in the error message doesn’t match with the one you shared in your question. Are you sure that this error corresponds with the file that you think it does? :thinking:

Even i am getting the same error