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

Viewed 1707

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

Best

1 Answers

Using terraform cloud as a backend, it is indeed required to adjust the specified version in the remote settings page (in my case, the version was set to an older release)

https://app.terraform.io/app/{org_name}/workspaces/{workspace_name}/settings/general

enter image description here

Related