Provider version constraints

Hi in the upcoming 4.0 changes ( Upcoming Changes in Version 4.0 of the AWS Provider · Issue #20433 · hashicorp/terraform-provider-aws · GitHub ) it says to use this version constraint to remain current with 3.x of the provider.

terraform {
  required_providers {
    aws = {
      version = "~> 3.x"
    }
  }
}

This doesn’t work for me, so is “~> 3.0” the correct constraint to remain up to date with the the latest 3.x versions without upgrading automatically to 4.x ?

Yes, using "~> 3.0" is a valid way to achieve this. The pessimistic operator ~> used with a two-segment version will ensure that you can upgrade to the latest version not including 4.0 or later.

You may want to specify a higher minimum provider version (e.g. "~> 3.50") if anything in your configuration depends on a specific provider version.

Thanks for the note about the typo in the issue, I’ve passed that on!