# Provider version constraints

**URL:** <https://discuss.hashicorp.com/t/provider-version-constraints/28994>\
**Category:** Terraform\
**Created:** [September 1, 2021, 2:41pm UTC](https://discuss.hashicorp.com/t/provider-version-constraints/28994 "2021-09-01T14:41:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fergoid](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/fergoid/32/19580_2.png) [@fergoid](https://discuss.hashicorp.com/u/fergoid)\
**Post date:** [September 1, 2021, 2:41pm UTC](https://discuss.hashicorp.com/t/provider-version-constraints/28994/1 "2021-09-01T14:41:57Z")

</div>

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

```auto
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 ?

---

<div class="post-metadata">

**Author:** ![alisdair](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/alisdair/32/4227_2.png) [@alisdair](https://discuss.hashicorp.com/u/alisdair)\
**Post date:** [September 1, 2021, 6:22pm UTC](https://discuss.hashicorp.com/t/provider-version-constraints/28994/2 "2021-09-01T18:22:36Z")

</div>

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!
