<h1>Upgrading to the newest version</h1>
<p>You can upgrade the provider with</p>
<pre class="lang-sh prettyprint-override"><code>terraform init -upgrade
</code></pre>
<p>So long as you don't have the version specified anywhere in a <code>required_providers</code> block.</p>
<h1>Pinning with a <code>required_providers</code> block</h1>
<p>You can pin or specify any <a href="https://www.terraform.io/language/expressions/version-constraints" rel="nofollow noreferrer">arbitrary version constraint</a> with a <code>required_providers</code> block, like this.</p>
<pre><code>terraform {
  required_providers {
    aws = {
      source = &quot;registry.terraform.io/hashicorp/aws&quot;
      version = &quot;4.14.0&quot;
    }
  }
}
provider &quot;aws&quot; {
  region = &quot;us-east-1&quot;
}
</code></pre>
<h1>Terraform pre 0.13</h1>
<p>Prior to Terraform version 0.13, you could specify your version in the provider block,</p>
<pre><code>provider &quot;aws&quot; {
  version = &quot;4.14.0&quot;
  region = &quot;us-east-1&quot;
}
</code></pre>
<hr />
<p>Find the official docs at,</p>
<ul>
<li><a href="https://learn.hashicorp.com/tutorials/terraform/provider-versioning#upgrade-the-aws-provider-version" rel="nofollow noreferrer">Lock and Upgrade Provider Versions: Upgrade the AWS provider version</a></li>
<li><a href="https://www.terraform.io/language/providers/requirements" rel="nofollow noreferrer">Provider Requirements</a></li>
</ul>

CC BY-SA 4.0
2022-05-14T19:31:53.997Z
2022-05-15T22:06:55.897Z
2022-05-15T22:06:55.897Z
Evan Carroll
<p>This is a follow-up to <a href="https://devops.stackexchange.com/questions/15954/the-provider-hashicorp-aws-does-not-support-resource-type-aws-internet-gateway">The provider hashicorp/aws does not support resource type &quot;aws_internet_gateway_attachment&quot;</a>.</p>
<p>The crux of it is, I'm using 3.75.1 of the AWS provider, and I need to upgrade. How do I do that?</p>
<p>I got the version by reading the <code>.terraform.lock.hcl</code></p>
<pre><code>provider &quot;registry.terraform.io/hashicorp/aws&quot; {
  version     = &quot;3.75.1&quot;
</code></pre>

<terraform><versioning>
How do I upgrade or pin a Terraform Provider?
Evan Carroll
# How do I upgrade or pin a Terraform Provider?

(Asked by: username_0 on 2022-05-14)

This is a follow-up to The provider hashicorp/aws does not support resource type "aws_internet_gateway_attachment".
The crux of it is, I'm using 3.75.1 of the AWS provider, and I need to upgrade. How do I do that?
I got the version by reading the .terraform.lock.hcl
provider "registry.terraform.io/hashicorp/aws" {
  version     = "3.75.1"

**Tags:** terraform, versioning


---

## 1 answers

### Answer by username_0 on 2022-05-14. Score: 1 | Accepted answer

Upgrading to the newest version
You can upgrade the provider with
terraform init -upgrade

So long as you don't have the version specified anywhere in a required_providers block.
Pinning with a required_providers block
You can pin or specify any arbitrary version constraint with a required_providers block, like this.
terraform {
  required_providers {
    aws = {
      source = "registry.terraform.io/hashicorp/aws"
      version = "4.14.0"
    }
  }
}
provider "aws" {
  region = "us-east-1"
}

Terraform pre 0.13
Prior to Terraform version 0.13, you could specify your version in the provider block,
provider "aws" {
  version = "4.14.0"
  region = "us-east-1"
}


Find the official docs at,

Lock and Upgrade Provider Versions: Upgrade the AWS provider version
Provider Requirements


---

